From d3fa3680b3be0be41797fa2ab02bbf90515fc3bc Mon Sep 17 00:00:00 2001 From: Greg Neagle Date: Tue, 14 May 2019 13:52:14 -0700 Subject: [PATCH] If softwareupdate launchd job fails, return the expected dictionary structure, not an integer return code --- code/client/munkilib/appleupdates/su_tool.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/code/client/munkilib/appleupdates/su_tool.py b/code/client/munkilib/appleupdates/su_tool.py index ccd601c1..c80ccf9c 100644 --- a/code/client/munkilib/appleupdates/su_tool.py +++ b/code/client/munkilib/appleupdates/su_tool.py @@ -106,15 +106,6 @@ def run(options_list, catalog_url=None, stop_allowed=False): display.display_debug1('softwareupdate cmd: %s', cmd) - try: - job = launchd.Job(cmd) - job.start() - except launchd.LaunchdJobException as err: - display.display_warning( - 'Error with launchd job (%s): %s', cmd, err) - display.display_warning('Skipping softwareupdate run.') - return -3 - results['installed'] = [] results['download'] = [] results['failures'] = [] @@ -122,6 +113,17 @@ def run(options_list, catalog_url=None, stop_allowed=False): results['exit_code'] = 0 results['post_action'] = POSTACTION_NONE + try: + job = launchd.Job(cmd) + job.start() + except launchd.LaunchdJobException as err: + message = 'Error with launchd job (%s): %s' % (cmd, err) + display.display_warning(message) + display.display_warning('Skipping softwareupdate run.') + results['exit_code'] = -3 + results['failures'].append(message) + return results + last_output = None while True: if stop_allowed and processes.stop_requested():