RHEL6: Fixing reposync UnboundLocalError: local variable ‘exit_code’ referenced…

yum-utils-1.1.31-7 fixes this issue, but it’s not available for RHEL (as far as I see). You can fix /usr/bin/reposync:

--- a/reposync.py
+++ b/reposync.py
@@ -198,6 +198,7 @@ def main():
         # maybe this shouldn't be entirely fatal
         sys.exit(1)
     
+    exit_code = 0
     for repo in my.repos.listEnabled():
         reposack = ListPackageSack(my.pkgSack.returnPackages(repoid=repo.id))
 
@@ -293,7 +294,6 @@ def main():
             pkg.repo.cache = 0
 
         # use downloader from YumBase
-        exit_code = 0
         probs = my.downloadPkgs(download_list)
         if probs:
             exit_code = 1

Found solution here.