Use the yaml stdout_callback for better prepare logging

Currently when the tripleo-modify-role runs a shell script which
produces a lot of output, its logged once as a no-newline-blob, and
again as one line per array item. Neither output is easy read, which makes
debugging harder.

This change switches to the yaml stdout_callback, and a verbosity
level which only prints the script output once.

Change-Id: I85fb8ca40e03f077147871fcd85536c0572d526e
Closes-Bug: #1813684
This commit is contained in:
Steve Baker 2019-01-29 14:10:24 +13:00
parent ff9f87447b
commit 2a6ef6a4f9
2 changed files with 18 additions and 6 deletions

View File

@ -243,8 +243,12 @@ class BaseImageUploader(object):
action = ansible.AnsiblePlaybookAction(
playbook=playbook,
work_dir=work_dir,
verbosity=3,
extra_env_variables=dict(os.environ)
verbosity=1,
extra_env_variables=dict(os.environ),
override_ansible_cfg=(
"[defaults]\n"
"stdout_callback=yaml\n"
)
)
result = action.run(None)
log_path = result.get('log_path')

View File

@ -799,8 +799,12 @@ class TestDockerImageUploader(base.TestCase):
mock_ansible.assert_called_once_with(
playbook=playbook,
work_dir=mock.ANY,
verbosity=3,
extra_env_variables=mock.ANY
verbosity=1,
extra_env_variables=mock.ANY,
override_ansible_cfg=(
"[defaults]\n"
"stdout_callback=yaml\n"
)
)
self.dockermock.return_value.tag.assert_not_called()
self.dockermock.return_value.push.assert_called_once_with(
@ -1100,8 +1104,12 @@ class TestSkopeoImageUploader(base.TestCase):
mock_ansible.assert_called_once_with(
playbook=playbook,
work_dir=mock.ANY,
verbosity=3,
extra_env_variables=mock.ANY
verbosity=1,
extra_env_variables=mock.ANY,
override_ansible_cfg=(
"[defaults]\n"
"stdout_callback=yaml\n"
)
)
@mock.patch('tripleo_common.image.image_uploader.'