Merge "Add a 'trash_output' flag to ansible playbook action"

This commit is contained in:
Zuul
2018-05-05 20:10:52 +00:00
committed by Gerrit Code Review
3 changed files with 6 additions and 0 deletions

View File

@@ -283,6 +283,7 @@ class AnsiblePlaybookAction(base.TripleOAction):
self.max_message_size = self._kwargs_for_run.pop(
'max_message_size', 1048576)
self.gather_facts = self._kwargs_for_run.pop('gather_facts', False)
self.trash_output = self._kwargs_for_run.pop('trash_output', False)
@property
def work_dir(self):
@@ -517,6 +518,9 @@ class AnsiblePlaybookAction(base.TripleOAction):
# stdout we don't know the difference. To keep the return dict
# similar there is an empty stderr. We can use the return code
# to determine if there was an error.
if self.trash_output:
stdout = []
stderr = ""
return {"stdout": "".join(stdout), "returncode": returncode,
"stderr": ""}

View File

@@ -352,6 +352,7 @@ workflows:
work_dir: <% $.get('work_dir') %>/<% execution().id %>
queue_name: <% $.queue_name %>
reproduce_command: true
trash_output: true
publish:
log_path: <% task().result.get('log_path') %>
on-success:

View File

@@ -145,6 +145,7 @@ workflows:
queue_name: <% $.ansible_queue_name %>
execution_id: <% execution().id %>
skip_tags: <% $.skip_tags %>
trash_output: true
on-success:
- node_update_passed: <% task().result.returncode = 0 %>
- node_update_failed: <% task().result.returncode != 0 %>