Add zuul_log_id to fully qualified command Ansible module args

This change prevents `ansible.builtin.command` usage to fail with
  `zuul_log_id missing`

Change-Id: Ie6ef0817a2d276af2e9949e9755f29343067df26
This commit is contained in:
Tristan Cacqueray 2022-03-29 16:16:57 +00:00
parent 81525f63be
commit 07ae92e174
2 changed files with 6 additions and 2 deletions

View File

@ -27,7 +27,9 @@ class ActionModule(command.ActionModule):
# we need the zuul_log_id on shell and command tasks
host = paths._sanitize_filename(task_vars.get('inventory_hostname'))
if self._task.action in ('command', 'shell'):
if self._task.action in (
'command', 'shell',
'ansible.builtin.command', 'ansible.builtin.shell'):
self._task.args['zuul_log_id'] = "%s-%s" % (self._task._uuid, host)
return super(ActionModule, self).run(tmp, task_vars)

View File

@ -23,7 +23,9 @@ class ActionModule(command.ActionModule):
def run(self, tmp=None, task_vars=None):
# we need the zuul_log_id on shell and command tasks
host = paths._sanitize_filename(task_vars.get('inventory_hostname'))
if self._task.action in ('command', 'shell'):
if self._task.action in (
'command', 'shell',
'ansible.builtin.command', 'ansible.builtin.shell'):
self._task.args['zuul_log_id'] = "%s-%s" % (self._task._uuid, host)
return super(ActionModule, self).run(tmp, task_vars)