From ed470de9919b8dd7ec5e2e8ab70eeaac933f7252 Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya <bdobreli@redhat.com> Date: Mon, 1 Jun 2020 10:59:50 +0200 Subject: [PATCH] Use tripleo custom stdout plugins in utils Iff8eec43bd73bc6486f56e741e740869d1b8acbb adjusted ansible config for custom 'tripleo_dense' and 'tripleo_profile_tasks' plugins. That was not sufficient because of bug/1881254. Align settings provided by run_ansible_playbook utility with that Iff8eec43bd73bc6486f56e741e740869d1b8acbb provides for tripleo_common shared ansible configuration module. That is to have: - better coverage in CI jobs - users experience as well. Callbacks whitelist defaults switches to tripleo_dense,tripleo_profile_tasks. And default output callback becomes tripleo_dense. Change-Id: I5e8bc9ac5cbf4a042b5cd7e27578092062839726 Related-Bug: #1881254 --- tripleoclient/constants.py | 1 + tripleoclient/utils.py | 20 +++++++++----------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/tripleoclient/constants.py b/tripleoclient/constants.py index 367ddf3f8..9bdde17fb 100644 --- a/tripleoclient/constants.py +++ b/tripleoclient/constants.py @@ -43,6 +43,7 @@ OVERCLOUD_NETWORKS_FILE = "network_data.yaml" STANDALONE_NETWORKS_FILE = "/dev/null" UNDERCLOUD_NETWORKS_FILE = "network_data_undercloud.yaml" ANSIBLE_HOSTS_FILENAME = "hosts.yaml" +ANSIBLE_CWL = "tripleo_dense,tripleo_profile_tasks" # The name of the file which holds the plan environment contents PLAN_ENVIRONMENT = 'plan-environment.yaml' diff --git a/tripleoclient/utils.py b/tripleoclient/utils.py index 3d44d15ba..9ce07c1eb 100644 --- a/tripleoclient/utils.py +++ b/tripleoclient/utils.py @@ -241,13 +241,14 @@ def playbook_verbosity(self): def run_ansible_playbook(playbook, inventory, workdir, playbook_dir=None, - connection='smart', output_callback='yaml', + connection='smart', output_callback='tripleo_dense', ssh_user='root', key=None, module_path=None, limit_hosts=None, tags=None, skip_tags=None, verbosity=0, quiet=False, extra_vars=None, extra_vars_file=None, plan='overcloud', gathering_policy='smart', extra_env_variables=None, - parallel_run=False, callback_whitelist=None, + parallel_run=False, + callback_whitelist=constants.ANSIBLE_CWL, ansible_cfg=None, ansible_timeout=30, reproduce_command=False, fail_on_rc=True, timeout=None): @@ -269,13 +270,14 @@ def run_ansible_playbook(playbook, inventory, workdir, playbook_dir=None, :param connection: Connection type (local, smart, etc). :type connection: String - :param output_callback: Callback for output format. Defaults to "json". + :param output_callback: Callback for output format. Defaults to + "tripleo_dense". :type output_callback: String :param callback_whitelist: Comma separated list of callback plugins. - Defaults to the value of `output_callback`. - When the verbosity is > 0 "profile_tasks" - will also be whitelisted. + Defaults to + "tripleo_dense,tripleo_profile_tasks". + Custom output_callback is also whitelisted. :type callback_whitelist: String :param ssh_user: User for the ssh connection. @@ -453,12 +455,8 @@ def run_ansible_playbook(playbook, inventory, workdir, playbook_dir=None, ) makedirs(ansible_fact_path) - if callback_whitelist: + if output_callback not in callback_whitelist.split(','): callback_whitelist = ','.join([callback_whitelist, output_callback]) - else: - callback_whitelist = output_callback - - callback_whitelist = ','.join([callback_whitelist, 'profile_tasks']) env = dict() env['ANSIBLE_SSH_ARGS'] = (