win_pkg: report failure for failed launch of Scheduled Task

If the Scheduled Task fails to launch, log this and report the failed status. Don't check for success as the Task Scheduler doesn't give return codes for actions it ran, and only the minion upgrade should be using this (so successful installation or removal would never be reported anyway).
This commit is contained in:
Morgan Willcock 2016-08-31 21:02:02 +01:00 committed by GitHub
parent e0978220f7
commit 108f9470f2

View file

@ -698,7 +698,10 @@ def install(name=None, refresh=False, pkgs=None, saltenv='base', **kwargs):
ac_only=False,
stop_if_on_batteries=False)
# Run Scheduled Task
__salt__['task.run_wait'](name='update-salt-software')
if not __salt__['task.run_wait'](name='update-salt-software'):
log.error('Failed to install {0}'.format(pkg_name))
log.error('Scheduled Task failed to run')
ret[pkg_name] = {'install status': 'failed'}
else:
# Build the install command
cmd = []
@ -959,7 +962,10 @@ def remove(name=None, pkgs=None, version=None, **kwargs):
ac_only=False,
stop_if_on_batteries=False)
# Run Scheduled Task
__salt__['task.run_wait'](name='update-salt-software')
if not __salt__['task.run_wait'](name='update-salt-software'):
log.error('Failed to remove {0}'.format(target))
log.error('Scheduled Task failed to run')
ret[target] = {'uninstall status': 'failed'}
else:
# Build the install command
cmd = []