anchor.diff:  rm -rf /root/rhnpackages
   mkdir -p /root/rhnpackages
   yum-config-manager --enable rhel-6-server-rpms
  -yumdownloader --releasever=<%= releasever %> --disablerepo='*' --enablerepo='*rhel*' --resolve --destdir /root/rhnpackages $rhnpackages
  +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
  +if [[ "$success" == "false" ]];then
  +  echo "Unable to download rhn-setup and redhat-release-server from RHSM." 1>&2
  +  echo "This may be due to a network error or yum configuration." 1>&2
  +fi
   #Delete in case yumdownloader gets extra packages
   repomanage -o /root/rhnpackages | xargs rm -f
   
  
positive.code:   fi
  done
  if [ $errors -gt 0 ]; then
    echo "There were problems enabling channels. Please check puppet manifests and your RHN Satellite channel configuration to ensure the necessary channels are enabled."
    exit 1
  fi
  
  
negative.code: done
  
  if [ $status -ne 0 ]; then
    echo "ERROR: Repotrack did not exit cleanly after <%= numtries %> tries." 1>&2
    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
    exit 1
  fi
  
  
  rm -f /etc/yum/vars/releasever
  yum-config-manager --enable 'nailgun' &> /dev/null
  
  #Run again just for good measure
  #yumdownloader --releasever=<%= releasever %> --disablerepo='*' --enablerepo='rhel*' --resolve --destdir "<%= pkgdir %>/Packages" $(cat /etc/nailgun/required-rpms.txt | xargs echo -en)
  