Fix command tasks with free play strategy
When using the free play strategy the command and shell tasks fail logging due to an undefined variable. Fix that and add tests for it. Change-Id: Ib869b12c54201b59f3de852b502ff62183db7266
This commit is contained in:
parent
bfcdff9118
commit
1310aa592b
|
@ -38,3 +38,11 @@
|
|||
handlers:
|
||||
- name: test handler
|
||||
command: echo "This is a handler"
|
||||
|
||||
- hosts: all
|
||||
strategy: free
|
||||
tasks:
|
||||
- name: Command task 1 within free strategy
|
||||
command: echo "First free task"
|
||||
- name: Command task 2 within free strategy
|
||||
command: echo "Second free task"
|
||||
|
|
|
@ -96,6 +96,8 @@ class TestZuulStream(AnsibleZuulTestCase):
|
|||
self.assertLogLine('TASK \[Show contents of second file\]', text)
|
||||
self.assertLogLine('controller \| command test two', text)
|
||||
self.assertLogLine('controller \| This is a handler', text)
|
||||
self.assertLogLine('controller \| First free task', text)
|
||||
self.assertLogLine('controller \| Second free task', text)
|
||||
self.assertLogLine(
|
||||
'controller \| ok: Runtime: \d:\d\d:\d\d\.\d\d\d\d\d\d', text)
|
||||
self.assertLogLine('PLAY RECAP', text)
|
||||
|
|
|
@ -210,6 +210,9 @@ class CallbackModule(default.CallbackModule):
|
|||
|
||||
if self._play.strategy != 'free':
|
||||
task_name = self._print_task_banner(task)
|
||||
else:
|
||||
task_name = task.get_name().strip()
|
||||
|
||||
if task.action in ('command', 'shell'):
|
||||
log_id = uuid.uuid4().hex
|
||||
task.args['zuul_log_id'] = log_id
|
||||
|
|
Loading…
Reference in New Issue