Revert "Overload stdout callback plugin"

This reverts commit 49d3f725f2.

Closes-Bug: #1858115
Change-Id: I49d560b2634847ea7f8bafefa8e7ee7f9726a193
Signed-off-by: Kevin Carter <kecarter@redhat.com>
This commit is contained in:
Kevin Carter (cloudnull) 2019-12-30 17:37:20 +00:00 committed by Kevin Carter
parent a7aac7ca5f
commit dbfe988265
No known key found for this signature in database
GPG Key ID: CE94BD890A47B20A
4 changed files with 6 additions and 37 deletions

View File

@ -82,13 +82,6 @@ class FakeClientWrapper(object):
return self.ws
class FakeRunnerConfig(object):
env = dict() # noqa
def prepare(self):
pass
def fake_ansible_runner_run_return(rc=0):
return 'Test Status', rc

View File

@ -860,9 +860,9 @@ class TestDeployUndercloud(TestPluginV1):
)
@mock.patch.object(
ansible_runner.runner_config,
'RunnerConfig',
return_value=fakes.FakeRunnerConfig()
ansible_runner.runner_config.RunnerConfig,
'prepare',
return_value=fakes.fake_ansible_runner_run_return()
)
@mock.patch.object(
ansible_runner.Runner,

View File

@ -124,7 +124,7 @@ class TempDirs(object):
:type dir_path: `string`
:param dir_prefix: prefix to add to a temp directory
:type dir_prefix: `string`
:param cleanup: when enabled the temp directory will be
:paramm cleanup: when enabled the temp directory will be
removed on exit.
:type cleanup: `boolean`
:param chdir: Change to/from the created temporary dir on enter/exit.
@ -207,8 +207,7 @@ def run_ansible_playbook(playbook, inventory, workdir, playbook_dir=None,
limit_hosts=None, tags=None, skip_tags=None,
verbosity=0, quiet=False, extra_vars=None,
plan='overcloud', gathering_policy='smart',
extra_env_variables=None, parallel_run=False,
callback_whitelist=None):
extra_env_variables=None):
"""Simple wrapper for ansible-playbook.
:param playbook: Playbook filename.
@ -230,12 +229,6 @@ def run_ansible_playbook(playbook, inventory, workdir, playbook_dir=None,
:param output_callback: Callback for output format. Defaults to "json".
: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.
:type callback_whitelist: String
:param ssh_user: User for the ssh connection.
:type ssh_user: String
@ -343,12 +336,7 @@ def run_ansible_playbook(playbook, inventory, workdir, playbook_dir=None,
with open(extra_vars) as f:
extravars.update(yaml.safe_load(f.read()))
if callback_whitelist:
callback_whitelist = ','.join([callback_whitelist, output_callback])
else:
callback_whitelist = output_callback
callback_whitelist = ','.join([callback_whitelist, 'profile_tasks'])
callback_whitelist = ','.join([output_callback, 'profile_tasks'])
env = os.environ.copy()
env['ANSIBLE_DISPLAY_FAILED_STDERR'] = True
@ -496,19 +484,8 @@ def run_ansible_playbook(playbook, inventory, workdir, playbook_dir=None,
if limit_hosts:
r_opts['limit'] = limit_hosts
if parallel_run:
r_opts['directory_isolation_base_path'] = ansible_artifact_path
runner_config = ansible_runner.runner_config.RunnerConfig(**r_opts)
runner_config.prepare()
# NOTE(cloudnull): overload the output callback after prepare
# to define the specific format we want.
# This is only required until PR
# https://github.com/ansible/ansible-runner/pull/387
# is merged and released. After this PR has been
# made available to us, this line should be removed.
runner_config.env['ANSIBLE_STDOUT_CALLBACK'] = \
r_opts['envvars']['ANSIBLE_STDOUT_CALLBACK']
runner = ansible_runner.Runner(config=runner_config)
status, rc = runner.run()

View File

@ -407,7 +407,6 @@ class TripleOValidatorRun(command.Command):
workdir=tmp,
playbook=playbook,
playbook_dir=constants.ANSIBLE_VALIDATION_DIR,
parallel_run=True,
inventory=static_inventory,
output_callback='validation_output',
quiet=True,