Catch exceptions that could be raised early in run_yum_transaction while
manipulating stdout or modifying the environment.
---
scripts/anaconda-yum | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/scripts/anaconda-yum b/scripts/anaconda-yum
index 341f7a9..cae3ee1 100755
--- a/scripts/anaconda-yum
+++ b/scripts/anaconda-yum
@@ -176,9 +176,6 @@ def run_yum_transaction(release, arch, yum_conf, install_root,
ts_file, script_l
logfile.close()
except YumBaseError as e:
print("ERROR: transaction error: %s" % e)
- # pylint: disable-msg=W0703
- except Exception as e:
- print("ERROR: unexpected error: %s" % e)
finally:
print("QUIT:")
@@ -393,12 +390,15 @@ class RPMCallback(object):
if __name__ == "__main__":
- arg_parser = setup_parser()
- args = arg_parser.parse_args()
+ try:
+ arg_parser = setup_parser()
+ args = arg_parser.parse_args()
- # force output to be flushed
- sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
-
- run_yum_transaction(args.release, args.arch, args.config, args.installroot,
- args.tsfile, args.rpmlog, args.test, args.debug)
+ # force output to be flushed
+ sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
+ run_yum_transaction(args.release, args.arch, args.config, args.installroot,
+ args.tsfile, args.rpmlog, args.test, args.debug)
+ # pylint: disable-msg=W0703
+ except Exception as e:
+ print("ERROR: unexpected error: %s" % e)
--
1.8.5.3