最近同步yum庫的時候有臺機器報錯 shell
reposync:349:main:UnboundLocalError: local variable 'exit_code' referenced before assignmentspa
居然觸發了一個這麼2的bug, 搜到 redhat bugzilla 2013年的bugcode
https://bugzilla.redhat.com/show_bug.cgi?id=882536
server
[abrt] yum-utils-1.1.31-4.fc17: reposync:349:main:UnboundLocalError: local variable 'exit_code' referenced before assignment
ip
# yum update yum-utils Loaded plugins: aliases, changelog, downloadonly, product-id, refresh-packagekit, security, subscription-manager, tmprepo, verify, versionlock This system is receiving updates from Red Hat Subscription Management. rhel-6-server-optional-rpms | 3.5 kB 00:00 rhel-6-server-rpms | 3.7 kB 00:00 Setting up Update Process Resolving Dependencies --> Running transaction check ---> Package yum-utils.noarch 0:1.1.30-14.el6 will be updated --> Processing Dependency: yum-utils-translations = 1.1.30-14.el6 for package: yum-plugin-aliases-1.1.30-14.el6.noarch ---> Package yum-utils.noarch 0:1.1.30-30.el6 will be an update --> Processing Dependency: yum >= 3.2.29-56 for package: yum-utils-1.1.30-30.el6.noarch --> Running transaction check ---> Package yum.noarch 0:3.2.29-40.el6 will be updated ---> Package yum.noarch 0:3.2.29-60.el6 will be an update ---> Package yum-plugin-aliases.noarch 0:1.1.30-14.el6 will be updated ---> Package yum-plugin-aliases.noarch 0:1.1.30-30.el6 will be an update --> Finished Dependency Resolution Dependencies Resolved ================================================================================================================================================================================================================ Package Arch Version Repository Size ================================================================================================================================================================================================================ Updating: yum-utils noarch 1.1.30-30.el6 rhel-6-server-rpms 110 k Updating for dependencies: yum noarch 3.2.29-60.el6 rhel-6-server-rpms 1.0 M yum-plugin-aliases noarch 1.1.30-30.el6 rhel-6-server-rpms 28 k Transaction Summary ================================================================================================================================================================================================================ Upgrade 3 Package(s) Total download size: 1.1 M
reposync 各類正常了。ci
修改部分
作用域
diff /tmp/reposync /tmp/reposync.1 200a201 > exit_code = 0 280d280 < exit_code = 0
呵呵 。 打了補丁之後代碼更新了同步
代碼:it
201 行io
exit_code = 0 # 補上了定義 for repo in my.repos.listEnabled():
280 行
去掉了
exit_code = 0 #
原來是個做用域的小問題。 完了