If softwareupdate launchd job fails, return the expected dictionary structure, not an integer return code

This commit is contained in:
Greg Neagle
2019-05-14 13:52:14 -07:00
parent f1df5d96a6
commit d3fa3680b3

View File

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