Merge "container_systemd: improve debugging if service never starts" into stable/train

This commit is contained in:
Zuul 2020-07-31 05:15:40 +00:00 committed by Gerrit Code Review
commit 01577ed329
1 changed files with 13 additions and 7 deletions

View File

@ -308,13 +308,19 @@ class ActionModule(ActionBase):
daemon_reload=False),
task_vars=tvars
)
if 'Result' in results['status']:
if results['status']['Result'] == 'success':
if results.get('changed', False):
self.changed = True
self.restarted.append('tripleo_{}.{}'.format(name,
extension))
return
try:
if 'Result' in results['status']:
if results['status']['Result'] == 'success':
if results.get('changed', False):
self.changed = True
self.restarted.append('tripleo_{}'
'.{}'.format(name, extension))
return
except KeyError:
# if 'systemd' task failed to start the service, the 'status'
# key doesn't exist, so we'll use the final raise to report the
# issue if the service never start after the attempts.
pass
raise AnsibleActionFail('Service {} has not started yet'.format(name))
def _restart_services(self, service_names, task_vars, extension='service'):