Update verbosity so it is consistently set

This change will set the verbosity consistently whenever a playbook is
executed via the client.

All tests have been updated to ensure that the verbosity setting is always
defined when a playbook is executed.

Change-Id: I35b10d48344c8b7f71186bc529a300f75d7b8d63
Signed-off-by: Kevin Carter <kecarter@redhat.com>
changes/13/717113/10
Kevin Carter 3 years ago committed by Emilien Macchi
parent c7ff66854a
commit 624a61f206
  1. 4
      tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py
  2. 3
      tripleoclient/tests/v1/overcloud_ffwd_upgrade/test_overcloud_ffwd_upgrade.py
  3. 7
      tripleoclient/tests/v1/overcloud_node/test_overcloud_node.py
  4. 3
      tripleoclient/tests/v1/overcloud_upgrade/test_overcloud_upgrade.py
  5. 3
      tripleoclient/tests/v1/test_overcloud_admin.py
  6. 11
      tripleoclient/tests/v1/test_overcloud_bios.py
  7. 7
      tripleoclient/tests/v1/test_overcloud_parameters.py
  8. 10
      tripleoclient/tests/v1/test_overcloud_plan.py
  9. 7
      tripleoclient/tests/v1/test_overcloud_raid.py
  10. 12
      tripleoclient/tests/v2/overcloud_node/test_overcloud_node.py
  11. 8
      tripleoclient/tests/v2/overcloud_support/test_overcloud_support.py
  12. 11
      tripleoclient/tests/v2/undercloud/test_backup.py
  13. 2
      tripleoclient/tests/workflows/test_baremetal.py
  14. 3
      tripleoclient/tests/workflows/test_parameters.py
  15. 16
      tripleoclient/tests/workflows/test_plan_management.py
  16. 18
      tripleoclient/utils.py
  17. 3
      tripleoclient/v1/overcloud_admin.py
  18. 21
      tripleoclient/v1/overcloud_bios.py
  19. 37
      tripleoclient/v1/overcloud_deploy.py
  20. 2
      tripleoclient/v1/overcloud_external_update.py
  21. 2
      tripleoclient/v1/overcloud_external_upgrade.py
  22. 5
      tripleoclient/v1/overcloud_ffwd_upgrade.py
  23. 18
      tripleoclient/v1/overcloud_node.py
  24. 1
      tripleoclient/v1/overcloud_parameters.py
  25. 23
      tripleoclient/v1/overcloud_plan.py
  26. 11
      tripleoclient/v1/overcloud_raid.py
  27. 2
      tripleoclient/v1/overcloud_update.py
  28. 5
      tripleoclient/v1/overcloud_upgrade.py
  29. 1
      tripleoclient/v1/tripleo_deploy.py
  30. 5
      tripleoclient/v1/undercloud_preflight.py
  31. 5
      tripleoclient/v2/overcloud_delete.py
  32. 20
      tripleoclient/v2/overcloud_node.py
  33. 1
      tripleoclient/v2/overcloud_support.py
  34. 1
      tripleoclient/v2/undercloud_backup.py
  35. 126
      tripleoclient/workflows/baremetal.py
  36. 73
      tripleoclient/workflows/deployment.py
  37. 4
      tripleoclient/workflows/parameters.py
  38. 36
      tripleoclient/workflows/plan_management.py
  39. 8
      tripleoclient/workflows/scale.py

@ -1660,7 +1660,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
inventory='localhost,',
playbook='cli-overcloud-node-provision.yaml',
playbook_dir='/usr/share/ansible/tripleo-playbooks',
verbosity=0,
verbosity=3,
workdir=mock.ANY
),
mock.call(
@ -1675,7 +1675,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
inventory='localhost,',
playbook='cli-overcloud-node-unprovision.yaml',
playbook_dir='/usr/share/ansible/tripleo-playbooks',
verbosity=0,
verbosity=3,
workdir=mock.ANY
)
])

@ -101,7 +101,8 @@ class TestFFWDUpgradePrepare(fakes.TestFFWDUpgradePrepare):
parsed_args.overcloud_ssh_network,
parsed_args.overcloud_ssh_user,
mock.ANY,
parsed_args.overcloud_ssh_port_timeout
parsed_args.overcloud_ssh_port_timeout,
mock.ANY
)
mock_overcloud_deploy.assert_called_once_with(parsed_args)

@ -199,7 +199,7 @@ class TestDeleteNode(fakes.TestDeleteNode):
mock.call(
playbook='cli-overcloud-node-unprovision.yaml',
inventory='localhost,',
verbosity=0,
verbosity=mock.ANY,
workdir=mock.ANY,
playbook_dir='/usr/share/ansible/tripleo-playbooks',
extra_vars={
@ -229,6 +229,7 @@ class TestDeleteNode(fakes.TestDeleteNode):
inventory='localhost,',
workdir=mock.ANY,
playbook_dir='/usr/share/ansible/tripleo-playbooks',
verbosity=mock.ANY,
extra_vars={
'access_path': '/var/lib/mistral',
'execution_user': mock.ANY},
@ -240,7 +241,7 @@ class TestDeleteNode(fakes.TestDeleteNode):
playbook_dir=mock.ANY,
skip_tags='opendev-validation',
ansible_cfg=None,
verbosity=1,
verbosity=mock.ANY,
ssh_user='tripleo-admin',
key=mock.ANY,
limit_hosts='overcast-controller-1:overcast-compute-0',
@ -253,7 +254,7 @@ class TestDeleteNode(fakes.TestDeleteNode):
mock.call(
inventory='localhost,',
playbook='cli-overcloud-node-unprovision.yaml',
verbosity=0,
verbosity=mock.ANY,
workdir=mock.ANY,
playbook_dir='/usr/share/ansible/tripleo-playbooks',
extra_vars={

@ -106,7 +106,8 @@ class TestOvercloudUpgradePrepare(fakes.TestOvercloudUpgradePrepare):
parsed_args.overcloud_ssh_network,
parsed_args.overcloud_ssh_user,
mock.ANY,
parsed_args.overcloud_ssh_port_timeout
parsed_args.overcloud_ssh_port_timeout,
mock.ANY
)
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'

@ -38,5 +38,6 @@ class TestAdminAuthorize(test_plugin.TestPluginV1):
parsed_args.overcloud_ssh_network,
parsed_args.overcloud_ssh_user,
mock.ANY,
parsed_args.overcloud_ssh_port_timeout
parsed_args.overcloud_ssh_port_timeout,
mock.ANY
)

@ -16,6 +16,7 @@ import tempfile
from osc_lib.tests import utils as test_utils
from tripleoclient.tests import fakes as ooofakes
from tripleoclient.tests.v1.baremetal import fakes
from tripleoclient.v1 import overcloud_bios
@ -48,7 +49,10 @@ class TestConfigureBIOS(Base):
def setUp(self):
super(TestConfigureBIOS, self).setUp()
self.cmd = overcloud_bios.ConfigureBIOS(self.app, None)
app_args = mock.Mock()
app_args.verbose_level = 1
self.app.options = ooofakes.FakeOptions()
self.cmd = overcloud_bios.ConfigureBIOS(self.app, app_args)
playbook_runner = mock.patch(
'tripleoclient.utils.run_ansible_playbook',
autospec=True
@ -144,7 +148,10 @@ class TestResetBIOS(Base):
def setUp(self):
super(TestResetBIOS, self).setUp()
self.cmd = overcloud_bios.ResetBIOS(self.app, None)
app_args = mock.Mock()
app_args.verbose_level = 1
self.app.options = ooofakes.FakeOptions()
self.cmd = overcloud_bios.ResetBIOS(self.app, app_args)
playbook_runner = mock.patch(
'tripleoclient.utils.run_ansible_playbook',
autospec=True

@ -19,6 +19,7 @@ from osc_lib.tests import utils
import yaml
from tripleoclient import exceptions
from tripleoclient.tests import fakes
from tripleoclient.v1 import overcloud_parameters
@ -26,8 +27,10 @@ class TestSetParameters(utils.TestCommand):
def setUp(self):
super(TestSetParameters, self).setUp()
self.cmd = overcloud_parameters.SetParameters(self.app, None)
app_args = mock.Mock()
app_args.verbose_level = 1
self.app.options = fakes.FakeOptions()
self.cmd = overcloud_parameters.SetParameters(self.app, app_args)
self.app.client_manager.workflow_engine = mock.Mock()
self.workflow = self.app.client_manager.workflow_engine

@ -95,7 +95,10 @@ class TestOvercloudCreatePlan(utils.TestCommand):
def setUp(self):
super(TestOvercloudCreatePlan, self).setUp()
self.cmd = overcloud_plan.CreatePlan(self.app, None)
app_args = mock.Mock()
app_args.verbose_level = 1
self.app.options = fakes.FakeOptions()
self.cmd = overcloud_plan.CreatePlan(self.app, app_args)
self.app.client_manager.workflow_engine = mock.Mock()
self.tripleoclient = mock.Mock()
self.app.client_manager.tripleoclient = self.tripleoclient
@ -172,6 +175,7 @@ class TestOvercloudCreatePlan(utils.TestCommand):
('templates', '/fake/path'),
('plan_environment_file', 'the_plan_environment.yaml')
]
self.app.options = fakes.FakeOptions()
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
mock_open = mock.mock_open()
@ -211,6 +215,7 @@ class TestOvercloudCreatePlan(utils.TestCommand):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# Run
self.app.options = fakes.FakeOptions()
self.cmd.take_action(parsed_args)
# Verify
mock_run_playbook.assert_called_once_with(
@ -233,6 +238,7 @@ class TestOvercloudDeployPlan(utils.TestCommand):
app_args = mock.Mock()
app_args.verbose_level = 1
self.app.options = fakes.FakeOptions()
self.cmd = overcloud_plan.DeployPlan(self.app, app_args)
sleep_patch = mock.patch('time.sleep')
@ -270,7 +276,7 @@ class TestOvercloudDeployPlan(utils.TestCommand):
"container": "overcast",
"run_validations": True,
"skip_deploy_identifier": False,
"timeout_mins": 240
"ansible_timeout": 240
},
verbosity=3,
)

@ -16,6 +16,7 @@ import tempfile
from osc_lib.tests import utils as test_utils
from tripleoclient.tests import fakes as ooofakes
from tripleoclient.tests.v1.baremetal import fakes
from tripleoclient.v1 import overcloud_raid
@ -24,8 +25,10 @@ class TestCreateRAID(fakes.TestBaremetal):
def setUp(self):
super(TestCreateRAID, self).setUp()
self.cmd = overcloud_raid.CreateRAID(self.app, None)
app_args = mock.Mock()
app_args.verbose_level = 1
self.app.options = ooofakes.FakeOptions()
self.cmd = overcloud_raid.CreateRAID(self.app, app_args)
self.workflow = self.app.client_manager.workflow_engine
self.conf = {

@ -113,6 +113,7 @@ class TestImportNode(fakes.TestOvercloudNode):
playbook=mock.ANY,
inventory=mock.ANY,
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
verbosity=mock.ANY,
extra_vars={
'node_uuids': ['MOCK_NODE_UUID'],
'run_validations': False,
@ -145,6 +146,7 @@ class TestImportNode(fakes.TestOvercloudNode):
playbook=mock.ANY,
inventory=mock.ANY,
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
verbosity=mock.ANY,
extra_vars={
'node_uuids': ['MOCK_NODE_UUID']
}
@ -205,6 +207,7 @@ class TestIntrospectNode(fakes.TestOvercloudNode):
playbook=mock.ANY,
inventory=mock.ANY,
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
verbosity=mock.ANY,
extra_vars={
'node_uuids': [],
'run_validations': False,
@ -226,6 +229,7 @@ class TestIntrospectNode(fakes.TestOvercloudNode):
playbook='cli-overcloud-node-provide.yaml',
inventory=mock.ANY,
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
verbosity=mock.ANY,
extra_vars={
'node_uuids': []
}
@ -244,6 +248,7 @@ class TestIntrospectNode(fakes.TestOvercloudNode):
playbook='cli-baremetal-introspect.yaml',
inventory=mock.ANY,
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
verbosity=mock.ANY,
extra_vars={
'node_uuids': nodes,
'run_validations': False,
@ -266,6 +271,7 @@ class TestIntrospectNode(fakes.TestOvercloudNode):
playbook='cli-overcloud-node-provide.yaml',
inventory=mock.ANY,
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
verbosity=mock.ANY,
extra_vars={
'node_uuids': nodes
}
@ -387,7 +393,7 @@ class TestProvisionNode(fakes.TestOvercloudNode):
inventory='localhost,',
playbook='cli-overcloud-node-provision.yaml',
playbook_dir='/usr/share/ansible/tripleo-playbooks',
verbosity=0,
verbosity=mock.ANY,
workdir=mock.ANY
)
@ -438,7 +444,7 @@ class TestUnprovisionNode(fakes.TestOvercloudNode):
inventory='localhost,',
playbook='cli-overcloud-node-unprovision.yaml',
playbook_dir='/usr/share/ansible/tripleo-playbooks',
verbosity=0,
verbosity=mock.ANY,
workdir=tmp
),
mock.call(
@ -454,7 +460,7 @@ class TestUnprovisionNode(fakes.TestOvercloudNode):
inventory='localhost,',
playbook='cli-overcloud-node-unprovision.yaml',
playbook_dir='/usr/share/ansible/tripleo-playbooks',
verbosity=0,
verbosity=mock.ANY,
workdir=tmp
)
])

@ -17,6 +17,7 @@ import mock
from osc_lib.tests import utils
from tripleoclient.tests import fakes
from tripleoclient.v2 import overcloud_support
@ -26,7 +27,10 @@ class TestOvercloudSupportReport(utils.TestCommand):
super(TestOvercloudSupportReport, self).setUp()
# Get the command object to test
self.cmd = overcloud_support.ReportExecute(self.app, None)
app_args = mock.Mock()
app_args.verbose_level = 1
self.app.options = fakes.FakeOptions()
self.cmd = overcloud_support.ReportExecute(self.app, app_args)
@mock.patch('tripleoclient.utils.run_ansible_playbook',
autospec=True)
@ -38,6 +42,7 @@ class TestOvercloudSupportReport(utils.TestCommand):
playbook='cli-support-collect-logs.yaml',
inventory=mock.ANY,
playbook_dir=mock.ANY,
verbosity=3,
extra_vars={
'server_name': 'all',
'sos_destination': '/var/lib/tripleo/support'
@ -55,6 +60,7 @@ class TestOvercloudSupportReport(utils.TestCommand):
playbook='cli-support-collect-logs.yaml',
inventory=mock.ANY,
playbook_dir=mock.ANY,
verbosity=3,
extra_vars={
'server_name': 'server1',
'sos_destination': 'test'

@ -18,6 +18,7 @@ import mock
from osc_lib.tests import utils
from tripleoclient import constants
from tripleoclient.tests import fakes
from tripleoclient.v2 import undercloud_backup
@ -27,7 +28,10 @@ class TestUndercloudBackup(utils.TestCommand):
super(TestUndercloudBackup, self).setUp()
# Get the command object to test
self.cmd = undercloud_backup.BackupUndercloud(self.app, None)
app_args = mock.Mock()
app_args.verbose_level = 1
self.app.options = fakes.FakeOptions()
self.cmd = undercloud_backup.BackupUndercloud(self.app, app_args)
self.app.client_manager.workflow_engine = mock.Mock()
self.workflow = self.app.client_manager.workflow_engine
@ -45,6 +49,7 @@ class TestUndercloudBackup(utils.TestCommand):
playbook='cli-undercloud-backup.yaml',
inventory='localhost,',
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
verbosity=3,
extra_vars={
'sources_path': '/home/stack/'
}
@ -69,6 +74,7 @@ class TestUndercloudBackup(utils.TestCommand):
playbook=mock.ANY,
inventory=mock.ANY,
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
verbosity=3,
extra_vars={'sources_path':
'/home/stack/,/tmp/bar.yaml,/tmp/foo.yaml'})
@ -94,6 +100,7 @@ class TestUndercloudBackup(utils.TestCommand):
workdir=mock.ANY,
playbook=mock.ANY,
inventory=mock.ANY,
verbosity=3,
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
extra_vars={'sources_path':
'/tmp/foo.yaml'})
@ -121,6 +128,7 @@ class TestUndercloudBackup(utils.TestCommand):
playbook=mock.ANY,
inventory=mock.ANY,
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
verbosity=3,
extra_vars={'sources_path':
'/home/stack/,/tmp/bar.yaml'})
@ -143,5 +151,6 @@ class TestUndercloudBackup(utils.TestCommand):
playbook=mock.ANY,
inventory=mock.ANY,
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
verbosity=3,
extra_vars={'sources_path':
'/home/stack/,/tmp/foo.yaml'})

@ -91,7 +91,7 @@ class TestBaremetalWorkflows(fakes.FakePlaybookExecution):
baremetal.configure_manageable_nodes(self.app.client_manager)
def test_clean_nodes_success(self):
baremetal.clean_nodes(self.app.client_manager, node_uuids=[])
baremetal.clean_nodes(node_uuids=[])
def test_clean_manageable_nodes_success(self):
baremetal.clean_manageable_nodes(

@ -141,6 +141,7 @@ class TestParameterWorkflows(utils.TestCommand):
inventory=mock.ANY,
workdir=mock.ANY,
playbook_dir=mock.ANY,
verbosity=0,
extra_vars={'num_phy_cores_per_numa_node_for_pmd': 2}
)
]
@ -179,6 +180,7 @@ class TestParameterWorkflows(utils.TestCommand):
inventory=mock.ANY,
workdir=mock.ANY,
playbook_dir=mock.ANY,
verbosity=0,
extra_vars={'num_phy_cores_per_numa_node_for_pmd': 2}
),
mock.call(
@ -186,6 +188,7 @@ class TestParameterWorkflows(utils.TestCommand):
inventory=mock.ANY,
workdir=mock.ANY,
playbook_dir='/playbook/dir-1',
verbosity=0,
extra_vars={'some_opt': 0}
)
]

@ -49,7 +49,7 @@ class TestPlanCreationWorkflows(utils.TestCommand):
"generate_passwords": True,
"validate": False
},
verbosity=3,
verbosity=0,
)
@mock.patch("tripleoclient.utils.run_ansible_playbook", autospec=True)
@ -77,7 +77,7 @@ class TestPlanCreationWorkflows(utils.TestCommand):
"generate_passwords": True,
"validate": False
},
verbosity=3,
verbosity=0,
)
self.assertIn(mock.call('the_roles_file.yaml', '/tht-root/'),
@ -110,7 +110,7 @@ class TestPlanCreationWorkflows(utils.TestCommand):
"plan_environment": "the-plan-environment.yaml",
"validate": False
},
verbosity=3,
verbosity=0,
)
mock_open_context.assert_has_calls(
[mock.call('the-plan-environment.yaml', 'rb')])
@ -141,7 +141,7 @@ class TestPlanCreationWorkflows(utils.TestCommand):
"generate_passwords": True,
"validate": False
},
verbosity=3,
verbosity=0,
)
mock_open_context.assert_has_calls(
[mock.call('the-network-data.yaml', 'rb')])
@ -170,7 +170,7 @@ class TestPlanCreationWorkflows(utils.TestCommand):
"generate_passwords": False,
"validate": False
},
verbosity=3,
verbosity=0,
)
@ -252,7 +252,7 @@ class TestPlanUpdateWorkflows(base.TestCommand):
"generate_passwords": True,
"validate": False
},
verbosity=3,
verbosity=1,
)
@mock.patch("tripleoclient.utils.run_ansible_playbook", autospec=True)
@ -288,7 +288,7 @@ class TestPlanUpdateWorkflows(base.TestCommand):
"generate_passwords": True,
"validate": False
},
verbosity=3,
verbosity=1,
)
@mock.patch("tripleoclient.utils.run_ansible_playbook", autospec=True)
@ -323,7 +323,7 @@ class TestPlanUpdateWorkflows(base.TestCommand):
"generate_passwords": True,
"validate": False
},
verbosity=3,
verbosity=1,
)

@ -204,6 +204,24 @@ def makedirs(dir_path):
return True
def playbook_verbosity(self):
"""Return an integer for playbook verbosity levels.
:param self: Class object used to interpret the runtime state.
:type self: Object
:returns: Integer
"""
if self.app.options.debug:
return 3
else:
if self.app_args.verbose_level <= 1:
return 0
else:
return self.app_args.verbose_level
def run_ansible_playbook(playbook, inventory, workdir, playbook_dir=None,
connection='smart', output_callback='yaml',
ssh_user='root', key=None, module_path=None,

@ -84,5 +84,6 @@ class Authorize(command.Command):
parsed_args.overcloud_ssh_network,
parsed_args.overcloud_ssh_user,
self.get_key_pair(parsed_args),
parsed_args.overcloud_ssh_port_timeout
parsed_args.overcloud_ssh_port_timeout,
verbosity=oooutils.playbook_verbosity(self=self)
)

@ -20,6 +20,7 @@ from osc_lib.i18n import _
import yaml
from tripleoclient import command
from tripleoclient import utils
from tripleoclient.workflows import baremetal
@ -81,11 +82,16 @@ class ConfigureBIOS(command.Command):
clients = self.app.client_manager
if parsed_args.node_uuids:
baremetal.apply_bios_configuration(
clients, node_uuids=parsed_args.node_uuids,
configuration=configuration)
node_uuids=parsed_args.node_uuids,
configuration=configuration,
verbosity=utils.playbook_verbosity(self=self)
)
else:
baremetal.apply_bios_configuration_on_manageable_nodes(
clients, configuration=configuration)
clients,
configuration=configuration,
verbosity=utils.playbook_verbosity(self=self)
)
class ResetBIOS(command.Command):
@ -114,6 +120,11 @@ class ResetBIOS(command.Command):
clients = self.app.client_manager
if parsed_args.node_uuids:
baremetal.reset_bios_configuration(
clients, node_uuids=parsed_args.node_uuids)
node_uuids=parsed_args.node_uuids,
verbosity=utils.playbook_verbosity(self=self)
)
else:
baremetal.reset_bios_configuration_on_manageable_nodes(clients)
baremetal.reset_bios_configuration_on_manageable_nodes(
clients=clients,
verbosity=utils.playbook_verbosity(self=self)
)

@ -222,9 +222,12 @@ class DeployOvercloud(command.Command):
# Invokes the workflows specified in plan environment file
if plan_env_file:
workflow_params.invoke_plan_env_workflows(self.clients,
stack_name,
plan_env_file)
workflow_params.invoke_plan_env_workflows(
self.clients,
stack_name,
plan_env_file,
verbosity=utils.playbook_verbosity(self=self)
)
workflow_params.check_deprecated_parameters(self.clients, stack_name)
@ -232,12 +235,16 @@ class DeployOvercloud(command.Command):
print("Deploying templates in the directory {0}".format(
os.path.abspath(tht_root)))
deployment.deploy_and_wait(
self.log, self.clients, stack,
stack_name, self.app_args.verbose_level,
log=self.log,
clients=self.clients,
stack=stack,
plan_name=stack_name,
verbose_level=utils.playbook_verbosity(self=self),
timeout=timeout,
run_validations=run_validations,
skip_deploy_identifier=skip_deploy_identifier,
deployment_options=deployment_options)
deployment_options=deployment_options
)
def _process_and_upload_environment(self, container_name,
env, moved_files, tht_root):
@ -299,6 +306,7 @@ class DeployOvercloud(command.Command):
inventory='localhost,',
workdir=tmp,
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
verbosity=utils.playbook_verbosity(self=self),
extra_vars={
"container": container_name,
"parameters": params
@ -397,14 +405,18 @@ class DeployOvercloud(command.Command):
parsed_args.plan_environment_file,
parsed_args.networks_file,
type(self)._keep_env_on_update,
validate_stack=False)
validate_stack=False,
verbosity_level=utils.playbook_verbosity(self=self)
)
else:
plan_management.create_plan_from_templates(
self.clients, parsed_args.stack, tht_root,
parsed_args.roles_file, generate_passwords,
parsed_args.plan_environment_file,
parsed_args.networks_file,
validate_stack=False)
validate_stack=False,
verbosity_level=utils.playbook_verbosity(self=self)
)
# Get any missing (e.g j2 rendered) files from the plan to tht_root
self._download_missing_files_from_plan(
@ -646,9 +658,9 @@ class DeployOvercloud(command.Command):
utils.run_ansible_playbook(
playbook='cli-overcloud-node-provision.yaml',
inventory='localhost,',
verbosity=self.app_args.verbose_level - 1,
workdir=tmp,
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
verbosity=utils.playbook_verbosity(self=self),
extra_vars=extra_vars,
)
@ -677,9 +689,9 @@ class DeployOvercloud(command.Command):
utils.run_ansible_playbook(
playbook='cli-overcloud-node-unprovision.yaml',
inventory='localhost,',
verbosity=self.app_args.verbose_level - 1,
workdir=tmp,
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
verbosity=utils.playbook_verbosity(self=self),
extra_vars={
"stack_name": parsed_args.stack,
"baremetal_deployment": roles,
@ -1006,7 +1018,8 @@ class DeployOvercloud(command.Command):
parsed_args.overcloud_ssh_network,
parsed_args.overcloud_ssh_user,
self.get_key_pair(parsed_args),
parsed_args.overcloud_ssh_port_timeout
parsed_args.overcloud_ssh_port_timeout,
verbosity=utils.playbook_verbosity(self=self)
)
if parsed_args.config_download_timeout:
@ -1028,7 +1041,7 @@ class DeployOvercloud(command.Command):
parsed_args.output_dir,
parsed_args.override_ansible_cfg,
timeout,
verbosity=self.app_args.verbose_level,
verbosity=utils.playbook_verbosity(self=self),
deployment_options=deployment_options,
in_flight_validations=parsed_args.inflight
)

@ -109,7 +109,7 @@ class ExternalUpdateRun(command.Command):
parsed_args.stack
),
output_dir=ansible_dir,
verbosity=self.app_args.verbose_level,
verbosity=oooutils.playbook_verbosity(self=self),
ansible_playbook_name=constants.EXTERNAL_UPDATE_PLAYBOOKS,
extra_vars=oooutils.parse_extra_vars(
extra_var_strings=parsed_args.extra_vars

@ -108,7 +108,7 @@ class ExternalUpgradeRun(command.Command):
parsed_args.stack
),
output_dir=ansible_dir,
verbosity=self.app_args.verbose_level,
verbosity=oooutils.playbook_verbosity(self=self),
ansible_playbook_name=constants.EXTERNAL_UPGRADE_PLAYBOOKS,
inventory_path=oooutils.get_tripleo_ansible_inventory(
parsed_args.static_inventory,

@ -92,7 +92,8 @@ class FFWDUpgradePrepare(DeployOvercloud):
parsed_args.overcloud_ssh_network,
parsed_args.overcloud_ssh_user,
self.get_key_pair(parsed_args),
parsed_args.overcloud_ssh_port_timeout
parsed_args.overcloud_ssh_port_timeout,
verbosity=oooutils.playbook_verbosity(self=self)
)
self.log.info("FFWD Upgrade Prepare on stack {0} complete.".format(
@ -161,7 +162,7 @@ class FFWDUpgradeRun(command.Command):
parsed_args.stack
),
output_dir=ansible_dir,
verbosity=self.app_args.verbose_level,
verbosity=oooutils.playbook_verbosity(self=self),
ansible_playbook_name=constants.FFWD_UPGRADE_PLAYBOOK,
inventory_path=oooutils.get_tripleo_ansible_inventory(
parsed_args.static_inventory,

@ -95,9 +95,9 @@ class DeleteNode(command.Command):
oooutils.run_ansible_playbook(
playbook='cli-overcloud-node-unprovision.yaml',
inventory='localhost,',
verbosity=self.app_args.verbose_level - 1,
workdir=tmp,
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
verbosity=oooutils.playbook_verbosity(self=self),
extra_vars={
"stack_name": parsed_args.stack,
"baremetal_deployment": roles,
@ -169,7 +169,8 @@ class DeleteNode(command.Command):
clients=clients,
stack=stack,
nodes=nodes,
timeout=parsed_args.timeout
timeout=parsed_args.timeout,
verbosity=oooutils.playbook_verbosity(self=self)
)
if parsed_args.baremetal_deployment:
@ -177,9 +178,9 @@ class DeleteNode(command.Command):
oooutils.run_ansible_playbook(
playbook='cli-overcloud-node-unprovision.yaml',
inventory='localhost,',
verbosity=self.app_args.verbose_level - 1,
workdir=tmp,
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
verbosity=oooutils.playbook_verbosity(self=self),
extra_vars={
"stack_name": parsed_args.stack,
"baremetal_deployment": roles,
@ -248,10 +249,15 @@ class CleanNode(command.Command):
nodes = parsed_args.node_uuids
if nodes:
baremetal.clean_nodes(self.app.client_manager,
node_uuids=parsed_args.node_uuids)
baremetal.clean_nodes(
node_uuids=parsed_args.node_uuids,
verbosity=oooutils.playbook_verbosity(self=self)
)
else:
baremetal.clean_manageable_nodes(self.app.client_manager)
baremetal.clean_manageable_nodes(
clients=self.app.client_manager,
verbosity=oooutils.playbook_verbosity(self=self)
)
if parsed_args.provide:
if nodes:

@ -60,6 +60,7 @@ class SetParameters(command.Command):
inventory='localhost,',
workdir=tmp,
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
verbosity=utils.playbook_verbosity(self=self),
extra_vars={
"container": parsed_args.name,
"parameters": params

@ -127,14 +127,18 @@ class CreatePlan(command.Command):
clients, name, parsed_args.templates,
generate_passwords=generate_passwords,
plan_env_file=parsed_args.plan_environment_file,
validate_stack=False)
validate_stack=False,
verbosity_level=utils.playbook_verbosity(self=self)
)
else:
plan_management.create_deployment_plan(
clients, container=name,
container=name,
generate_passwords=generate_passwords,
source_url=source_url,
use_default_templates=use_default_templates,
validate_stack=False)
validate_stack=False,
verbosity_level=utils.playbook_verbosity(self=self)
)
class DeployPlan(command.Command):
@ -163,10 +167,15 @@ class DeployPlan(command.Command):
stack = utils.get_stack(orchestration_client, parsed_args.name)
print("Starting to deploy plan: {}".format(parsed_args.name))
deployment.deploy_and_wait(self.log, clients, stack, parsed_args.name,
self.app_args.verbose_level,
timeout=parsed_args.timeout,
run_validations=parsed_args.run_validations)
deployment.deploy_and_wait(
log=self.log,
clients=clients,
stack=stack,
plan_name=parsed_args.name,
verbose_level=utils.playbook_verbosity(self=self),
timeout=parsed_args.timeout,
run_validations=parsed_args.run_validations,
)
class ExportPlan(command.Command):

@ -20,6 +20,7 @@ from osc_lib.i18n import _
import yaml
from tripleoclient import command
from tripleoclient import utils
from tripleoclient.workflows import baremetal
@ -70,7 +71,9 @@ class CreateRAID(command.Command):
_('Logical disks list is expected to be a list of objects, '
'got %r instead') % disks)
clients = self.app.client_manager
baremetal.create_raid_configuration(clients,
node_uuids=parsed_args.node,
configuration=configuration)
baremetal.create_raid_configuration(
clients=self.app.client_manager,
node_uuids=parsed_args.node,
configuration=configuration,
verbosity=utils.playbook_verbosity(self=self)
)

@ -160,7 +160,7 @@ class UpdateRun(command.Command):
parsed_args.stack
),
output_dir=ansible_dir,
verbosity=self.app_args.verbose_level,
verbosity=oooutils.playbook_verbosity(self=self),
ansible_playbook_name=playbook,
inventory_path=oooutils.get_tripleo_ansible_inventory(
parsed_args.static_inventory,

@ -88,7 +88,8 @@ class UpgradePrepare(DeployOvercloud):
parsed_args.overcloud_ssh_network,
parsed_args.overcloud_ssh_user,
self.get_key_pair(parsed_args),
parsed_args.overcloud_ssh_port_timeout
parsed_args.overcloud_ssh_port_timeout,
verbosity=oooutils.playbook_verbosity(self=self)
)
self.log.info("Completed Overcloud Upgrade Prepare for stack "
@ -214,7 +215,7 @@ class UpgradeRun(command.Command):
parsed_args.stack
),
output_dir=ansible_dir,
verbosity=self.app_args.verbose_level,
verbosity=oooutils.playbook_verbosity(self=self),
ansible_playbook_name=playbook,
inventory_path=oooutils.get_tripleo_ansible_inventory(
parsed_args.static_inventory,

@ -1319,6 +1319,7 @@ class Deploy(command.Command):
'inventory.yaml'
),
workdir=self.ansible_dir,
verbosity=utils.playbook_verbosity(self=self),
extra_env_variables=extra_env_var,
fail_on_rc=False,
**operation

@ -75,7 +75,7 @@ def _run_live_command(args, env=None, name=None, cwd=None, wait=True):
raise RuntimeError(message)
def _check_diskspace(upgrade=False):
def _check_diskspace(upgrade=False, verbose_level=0):
"""Check undercloud disk space
This runs a simple ansible playbook located in tripleo-validations
@ -97,6 +97,7 @@ def _check_diskspace(upgrade=False):
connection='local',
output_callback='validation_output',
playbook_dir=constants.ANSIBLE_VALIDATION_DIR,
verbosity=verbose_level,
**playbook_args
)
@ -492,7 +493,7 @@ def check(verbose_level, upgrade=False):
_checking_status('Memory')
_check_memory()
_checking_status('Disk space')
_check_diskspace(upgrade)
_check_diskspace(upgrade, verbose_level)
_checking_status('Sysctl')
_check_sysctl()
_checking_status('Password file')

@ -62,10 +62,11 @@ class DeleteOvercloud(command.Command):
"cli-overcloud-delete.yaml",
'undercloud,',
constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
verbosity=utils.playbook_verbosity(self=self),
extra_vars={
"stack_name": parsed_args.stack
},
verbosity=3 if self.app.options.debug else 1
}
)
print("Success.")

@ -122,12 +122,13 @@ class ImportNode(command.Command):
inventory='localhost,',
workdir=tmp,
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
verbosity=oooutils.playbook_verbosity(self=self),
extra_vars=extra_vars
)
if parsed_args.provide:
baremetal.provide(
self.app.client_manager,
verbosity=oooutils.playbook_verbosity(self=self),
node_uuids=nodes_uuids
)
@ -172,14 +173,16 @@ class IntrospectNode(command.Command):
baremetal.introspect_manageable_nodes(
self.app.client_manager,
run_validations=parsed_args.run_validations,
concurrency=parsed_args.concurrency
concurrency=parsed_args.concurrency,
verbosity=oooutils.playbook_verbosity(self=self)
)
else:
baremetal.introspect(
self.app.client_manager,
node_uuids=parsed_args.node_uuids,
run_validations=parsed_args.run_validations,
concurrency=parsed_args.concurrency
concurrency=parsed_args.concurrency,
verbosity=oooutils.playbook_verbosity(self=self)
)
# NOTE(cloudnull): This is using the old provide function, in a future
@ -191,7 +194,10 @@ class IntrospectNode(command.Command):
node_uuids=parsed_args.node_uuids,
)
else:
baremetal.provide_manageable_nodes(self.app.client_manager)
baremetal.provide_manageable_nodes(
clients=self.app.client_manager,
verbosity=oooutils.playbook_verbosity(self=self)
)
class ProvisionNode(command.Command):
@ -258,9 +264,9 @@ class ProvisionNode(command.Command):
oooutils.run_ansible_playbook(
playbook='cli-overcloud-node-provision.yaml',
inventory='localhost,',
verbosity=self.app_args.verbose_level - 1,
workdir=tmp,
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
verbosity=oooutils.playbook_verbosity(self=self),
extra_vars=extra_vars,
)
@ -308,9 +314,9 @@ class UnprovisionNode(command.Command):
oooutils.run_ansible_playbook(
playbook='cli-overcloud-node-unprovision.yaml',
inventory='localhost,',
verbosity=self.app_args.verbose_level - 1,
workdir=tmp,
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
verbosity=oooutils.playbook_verbosity(self=self),
extra_vars={
"stack_name": parsed_args.stack,
"baremetal_deployment": roles,
@ -336,9 +342,9 @@ class UnprovisionNode(command.Command):
oooutils.run_ansible_playbook(
playbook='cli-overcloud-node-unprovision.yaml',
inventory='localhost,',
verbosity=self.app_args.verbose_level - 1,
workdir=tmp,
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
verbosity=oooutils.playbook_verbosity(self=self),
extra_vars={
"stack_name": parsed_args.stack,
"baremetal_deployment": roles,

@ -93,5 +93,6 @@ class ReportExecute(command.Command):
inventory=constants.ANSIBLE_INVENTORY,
workdir=tmp,
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
verbosity=utils.playbook_verbosity(self=self),
extra_vars=extra_vars
)

@ -90,6 +90,7 @@ class BackupUndercloud(command.Command):
inventory='localhost,',
workdir=tmp,
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
verbosity=utils.playbook_verbosity(self=self),
extra_vars=extra_vars
)

@ -113,11 +113,11 @@ def _format_errors(payload):
return '\n'.join(errors)
def provide(clients, node_uuids):
def provide(verbosity, node_uuids):
"""Provide Baremetal Nodes
:param clients: Application client object.
:type clients: Object
:param verbosity: Verbosity level
:type verbosity: Integer
:param node_uuids: List of instance UUID(s).
:type node_uuids: List
@ -129,6 +129,7 @@ def provide(clients, node_uuids):
inventory='localhost,',
workdir=tmp,
playbook_dir=constants.ANSIBLE_TRIPLEO_PLAYBOOKS,
verbosity=verbosity,
extra_vars={
'node_uuids': node_uuids
}
@ -137,18 +138,18 @@ def provide(clients, node_uuids):
print('Successfully provided nodes: {}'.format(node_uuids))
def provide_manageable_nodes(clients):
def provide_manageable_nodes(clients, verbosity=0):
"""Provide all manageable Nodes
:param clients: Application client object.
:type clients: Object
:param node_uuids: List of instance UUID(s).
:type node_uuids: List
:param verbosity: Verbosity level
:type verbosity: Integer
"""
provide(
clients,
verbosity=verbosity,
node_uuids=[
i.uuid for i in clients.baremetal.node.list()
if i.provision_state == "manageable" and not i.maintenance
@ -156,10 +157,24 @@ def provide_manageable_nodes(clients):
)
def introspect(clients, node_uuids, run_validations, concurrency):
def introspect(clients, node_uuids, run_validations, concurrency,
verbosity=0):
"""Introspect Baremetal Nodes
Run the tripleo.baremetal.v1.introspect Mistral workflow.
:param clients: Application client object.
:type clients: Object