anchor.diff: -#!/bin/bash -x
  +#!/bin/bash -xe
  +
  +function revert_back_to_centos() {
  +# Removes redhat-release-server rpm and replaces it with centos-release
  +  echo "Removing Red Hat temporary configuration."
  +  if rpm -q redhat-release-server &>/dev/null; then
  +    rpm -Uvh --force /root/centos-release/centos-release*.rpm
  +    rpm -e --nodeps --noscripts redhat-release-server
  +  fi
  +  #Disable subscription-manager and rhn plugins
  +  for plugin in $rhsm_plugins $rhn_plugins; do
  +    sed -i 's/^enabled.*/enabled=0/' "/etc/yum/pluginconf.d/${plugin}.conf" 2>/dev/null || :
  +  done
  +  rm -f /etc/yum/vars/releasever
  +  yum-config-manager --enable 'nailgun' &> /dev/null
  +}
  +trap revert_back_to_centos EXIT
  +
  +rhsm_plugins="product-id subscription-manager"
  +rhn_plugins="rhnplugin"
  +#Enable subscription-manager plugins
  +for plugin in $rhsm_plugins; do
  +  sed -i 's/^enabled.*/enabled=1/' "/etc/yum/pluginconf.d/${plugin}.conf" 2>/dev/null || :
  +done
  +
   #Register
   subscription-manager register "--username=<%= rh_username %>" "--password=<%= rh_password %>" --autosubscribe --force 
   
  
positive.code: success="false"
  for tries in 1 2 3; do
    yumdownloader --releasever=<%= releasever %> --disablerepo='nailgun*' --disablerepo='fuel*' --setopt='*.skip_if_unavailable=1' --resolve --destdir /root/rhnpackages $rhnpackages
    if [ $? -eq 0 ]; then
      #Verify we have packages downloaded
      if [[ "$(find /root/rhnpackages | wc -l)" > 2 ]]; then
        success="true"
        break
      fi
    fi
    yum clean expire-cache
  done
  
negative.code: 
  if [ $status -ne 0 ]; then
    echo "ERROR: Repotrack did not exit cleanly after <%= numtries %> tries." 1>&2
    revert_back_to_centos
    exit 1
  fi
  if [ $before -ne $after ]; then
    echo "ERROR: There are still some packages with broken md5 sum after last (<%= numtries %>) retry to download them." 1>&2
    revert_back_to_centos
    exit 1
  fi
  
  
  rm -f /etc/yum/vars/releasever
  yum-config-manager --enable 'nailgun' &> /dev/null
  
  #Disable all RHEL repos so you don't accidentally update and break master node
  yum-config-manager --disable '*rhel*' &> /dev/null
  