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():