Add verbosity level to the ansible update/upgrade run

The tripleo-common allow us to provide a verbosity level
but its not possible to pass it with the cli.
This review catch the --debug option passed to the cli
and provide it to package_update workflow

Manual Cherry pick from: Ib1fc8f6aab9a0b1a26945d441185b5c8ccb6e7dd

Change-Id: Ib1fc8f6aab9a0b1a26945d441185b5c8ccb6e7dd
This commit is contained in:
Mathieu Bultel 2019-01-17 17:57:55 +01:00 committed by Sergii Golovatiuk
parent 4c10f387fa
commit 8072fc1ec1
8 changed files with 34 additions and 18 deletions

View File

@ -159,7 +159,8 @@ class TestFFWDUpgradeRun(fakes.TestFFWDUpgradeRun):
nodes='',
playbook=constants.FFWD_UPGRADE_PLAYBOOK,
node_user='heat-admin',
skip_tags=''
skip_tags='',
verbosity=1
)
@mock.patch('tripleoclient.workflows.package_update.update_ansible',
@ -183,7 +184,8 @@ class TestFFWDUpgradeRun(fakes.TestFFWDUpgradeRun):
nodes='',
playbook=constants.FFWD_UPGRADE_PLAYBOOK,
node_user='my-user',
skip_tags=''
skip_tags='',
verbosity=1
)
@mock.patch('tripleoclient.workflows.package_update.update_ansible',

View File

@ -150,7 +150,8 @@ class TestOvercloudUpdateRun(fakes.TestOvercloudUpdateRun):
inventory_file=mock_open().read(),
playbook='fake-playbook.yaml',
node_user='tripleo-admin',
skip_tags=''
skip_tags='',
verbosity=1
)
@mock.patch('tripleoclient.workflows.package_update.update_ansible',
@ -179,7 +180,8 @@ class TestOvercloudUpdateRun(fakes.TestOvercloudUpdateRun):
inventory_file=mock_open().read(),
playbook=book,
node_user='heat-admin',
skip_tags=''
skip_tags='',
verbosity=1
)
@mock.patch('tripleoclient.workflows.package_update.update_ansible',
@ -207,7 +209,8 @@ class TestOvercloudUpdateRun(fakes.TestOvercloudUpdateRun):
inventory_file=mock_open().read(),
playbook=book,
node_user='heat-admin',
skip_tags=''
skip_tags='',
verbosity=1
)
@mock.patch('tripleoclient.workflows.package_update.update_ansible',

View File

@ -164,7 +164,8 @@ class TestOvercloudUpgradeRun(fakes.TestOvercloudUpgradeRun):
inventory_file=mock_open().read(),
playbook='fake-playbook.yaml',
node_user='tripleo-admin',
skip_tags=''
skip_tags='',
verbosity=1
)
@mock.patch('tripleoclient.workflows.package_update.update_ansible',
@ -195,7 +196,8 @@ class TestOvercloudUpgradeRun(fakes.TestOvercloudUpgradeRun):
inventory_file=mock_open().read(),
playbook=book,
node_user='heat-admin',
skip_tags='validation'
skip_tags='validation',
verbosity=1
)
@mock.patch('tripleoclient.workflows.package_update.update_ansible',
@ -224,7 +226,8 @@ class TestOvercloudUpgradeRun(fakes.TestOvercloudUpgradeRun):
inventory_file=mock_open().read(),
playbook='fake-playbook.yaml',
node_user='heat-admin',
skip_tags=''
skip_tags='',
verbosity=1
)
@mock.patch('tripleoclient.workflows.package_update.update_ansible',
@ -253,7 +256,8 @@ class TestOvercloudUpgradeRun(fakes.TestOvercloudUpgradeRun):
inventory_file=mock_open().read(),
playbook=book,
node_user='heat-admin',
skip_tags=''
skip_tags='',
verbosity=1
)
@mock.patch('tripleoclient.workflows.package_update.update_ansible',
@ -284,7 +288,8 @@ class TestOvercloudUpgradeRun(fakes.TestOvercloudUpgradeRun):
inventory_file=mock_open().read(),
playbook=book,
node_user='heat-admin',
skip_tags='pre-upgrade,validation'
skip_tags='pre-upgrade,validation',
verbosity=1
)
@mock.patch('tripleoclient.workflows.package_update.update_ansible',

View File

@ -827,7 +827,8 @@ def get_tripleo_ansible_inventory(inventory_file='',
def run_update_ansible_action(log, clients, nodes, inventory, playbook,
all_playbooks, action, ssh_user, skip_tags=''):
all_playbooks, action, ssh_user,
skip_tags='', verbosity=1):
playbooks = [playbook]
if playbook == "all":
playbooks = all_playbooks
@ -835,7 +836,7 @@ def run_update_ansible_action(log, clients, nodes, inventory, playbook,
log.debug("Running ansible playbook %s " % book)
action.update_ansible(clients, nodes=nodes, inventory_file=inventory,
playbook=book, node_user=ssh_user,
skip_tags=skip_tags)
skip_tags=skip_tags, verbosity=verbosity)
def prepend_environment(environment_files, templates_dir, environment):

View File

@ -143,7 +143,7 @@ class FFWDUpgradeRun(command.Command):
def take_action(self, parsed_args):
self.log.debug("take_action(%s)" % parsed_args)
oooutils.ffwd_upgrade_operator_confirm(parsed_args.yes, self.log)
verbosity = self.app_args.verbose_level
clients = self.app.client_manager
# Run ansible:
@ -155,7 +155,7 @@ class FFWDUpgradeRun(command.Command):
oooutils.run_update_ansible_action(
self.log, clients, limit_hosts, inventory,
constants.FFWD_UPGRADE_PLAYBOOK, [], package_update,
parsed_args.ssh_user)
parsed_args.ssh_user, verbosity=verbosity)
class FFWDUpgradeConverge(DeployOvercloud):

View File

@ -142,6 +142,7 @@ class UpdateRun(command.Command):
def take_action(self, parsed_args):
self.log.debug("take_action(%s)" % parsed_args)
clients = self.app.client_manager
verbosity = self.app_args.verbose_level
stack = parsed_args.stack
# Run ansible:
@ -156,7 +157,8 @@ class UpdateRun(command.Command):
playbook,
constants.MINOR_UPDATE_PLAYBOOKS,
package_update,
parsed_args.ssh_user)
parsed_args.ssh_user,
verbosity=verbosity)
class UpdateConverge(DeployOvercloud):

View File

@ -190,6 +190,7 @@ class UpgradeRun(command.Command):
def take_action(self, parsed_args):
self.log.debug("take_action(%s)" % parsed_args)
clients = self.app.client_manager
verbosity = self.app_args.verbose_level
stack = parsed_args.stack
# Run ansible:
@ -204,7 +205,9 @@ class UpgradeRun(command.Command):
inventory, playbook,
constants.MAJOR_UPGRADE_PLAYBOOKS,
package_update,
parsed_args.ssh_user, skip_tags)
parsed_args.ssh_user,
skip_tags=skip_tags,
verbosity=verbosity)
playbooks = (constants.MAJOR_UPGRADE_PLAYBOOKS
if playbook == 'all' else playbook)

View File

@ -78,8 +78,8 @@ class BackupUndercloud(command.Command):
output = undercloud_backup.backup(clients, workflow_input)
LOG.info(output)
except Exception as e:
print ("Undercloud backup finished with errors")
print ('Output: {}'.format(e))
print("Undercloud backup finished with errors")
print('Output: {}'.format(e))
LOG.info(e)
def take_action(self, parsed_args):