diff options
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/provider/package/yum/yum_helper.py | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/lib/chef/provider/package/yum/yum_helper.py b/lib/chef/provider/package/yum/yum_helper.py index 7e99951555..8f41b6d188 100644 --- a/lib/chef/provider/package/yum/yum_helper.py +++ b/lib/chef/provider/package/yum/yum_helper.py @@ -185,27 +185,30 @@ else: inpipe = os.fdopen(int(sys.argv[1]), "r") outpipe = os.fdopen(int(sys.argv[2]), "w") -while 1: - # kill self if we get orphaned (tragic) - ppid = os.getppid() - if ppid == 1: - sys.exit(0) - setup_exit_handler() - line = inpipe.readline() - - try: - command = json.loads(line) - except ValueError, e: - base.closeRpmDB() - sys.exit(0) - - if command['action'] == "whatinstalled": - query(command) - elif command['action'] == "whatavailable": - query(command) - elif command['action'] == "versioncompare": - versioncompare(command['versions']) - elif command['action'] == "installonlypkgs": - install_only_packages(command['package']) - else: - raise RuntimeError("bad command") +try: + while 1: + # kill self if we get orphaned (tragic) + ppid = os.getppid() + if ppid == 1: + raise RuntimeError("orphaned") + + setup_exit_handler() + line = inpipe.readline() + + try: + command = json.loads(line) + except ValueError, e: + raise RuntimeError("bad json parse") + + if command['action'] == "whatinstalled": + query(command) + elif command['action'] == "whatavailable": + query(command) + elif command['action'] == "versioncompare": + versioncompare(command['versions']) + elif command['action'] == "installonlypkgs": + install_only_packages(command['package']) + else: + raise RuntimeError("bad command") +finally: + base.closeRpmDB() |