Pass container name to update_nodes workflow

The container name needs to be passed with the stack name value to the
update_nodes workflow so that the right config container is used during
the update.

Previously, this was not an issue since all update actions just
defaulted to overcloud-config even if the stack name wasn't overcloud.

However, with the multiple overclouds feature and the multi-stack
feature, we need to make sure the right config container is used that
matches the stack name.

Closes-Bug: #1854991
Depends-On: Id6b4a5913141fc558c40f2cfd29f5e0741544ab4
Change-Id: Ib25d8f8fbfde8fb13bd6518fd2383b7e3ae7abee
(cherry picked from commit 819dab257d)
This commit is contained in:
James Slagle 2019-12-03 16:51:04 -05:00
parent 8efc50c6dc
commit 585fb2816c
11 changed files with 23 additions and 9 deletions

View File

@ -55,6 +55,7 @@ class TestOvercloudExternalUpdateRun(fakes.TestOvercloudExternalUpdateRun):
self.cmd.take_action(parsed_args)
update_ansible.assert_called_once_with(
self.app.client_manager,
container='overcloud',
nodes='all',
inventory_file=mock_open().__enter__().read(),
playbook='external_update_steps_playbook.yaml',
@ -87,6 +88,7 @@ class TestOvercloudExternalUpdateRun(fakes.TestOvercloudExternalUpdateRun):
self.cmd.take_action(parsed_args)
update_ansible.assert_called_once_with(
self.app.client_manager,
container='overcloud',
nodes='all',
inventory_file=mock_open().__enter__().read(),
playbook='external_update_steps_playbook.yaml',

View File

@ -55,6 +55,7 @@ class TestOvercloudExternalUpgradeRun(fakes.TestOvercloudExternalUpgradeRun):
self.cmd.take_action(parsed_args)
update_ansible.assert_called_once_with(
self.app.client_manager,
container='overcloud',
nodes='all',
inventory_file=mock_open().__enter__().read(),
playbook='external_upgrade_steps_playbook.yaml',
@ -87,6 +88,7 @@ class TestOvercloudExternalUpgradeRun(fakes.TestOvercloudExternalUpgradeRun):
self.cmd.take_action(parsed_args)
update_ansible.assert_called_once_with(
self.app.client_manager,
container='overcloud',
nodes='all',
inventory_file=mock_open().__enter__().read(),
playbook='external_upgrade_steps_playbook.yaml',

View File

@ -163,6 +163,7 @@ class TestFFWDUpgradeRun(fakes.TestFFWDUpgradeRun):
self.cmd.take_action(parsed_args)
upgrade_ansible.assert_called_once_with(
self.app.client_manager,
container='overcloud',
inventory_file=mock_open().__enter__().read(),
nodes='',
playbook=constants.FFWD_UPGRADE_PLAYBOOK,
@ -190,6 +191,7 @@ class TestFFWDUpgradeRun(fakes.TestFFWDUpgradeRun):
self.cmd.take_action(parsed_args)
upgrade_ansible.assert_called_once_with(
self.app.client_manager,
container='overcloud',
inventory_file=mock_open().__enter__().read(),
nodes='',
playbook=constants.FFWD_UPGRADE_PLAYBOOK,

View File

@ -148,6 +148,7 @@ class TestOvercloudUpdateRun(fakes.TestOvercloudUpdateRun):
self.cmd.take_action(parsed_args)
update_ansible.assert_called_once_with(
self.app.client_manager,
container='overcloud',
nodes='Compute',
inventory_file=mock_open().__enter__().read(),
playbook='fake-playbook.yaml',
@ -180,6 +181,7 @@ class TestOvercloudUpdateRun(fakes.TestOvercloudUpdateRun):
for book in constants.MINOR_UPDATE_PLAYBOOKS:
update_ansible.assert_any_call(
self.app.client_manager,
container='overcloud',
nodes='Compute',
inventory_file=mock_open().__enter__().read(),
playbook=book,

View File

@ -183,6 +183,7 @@ class TestOvercloudUpgradeRun(fakes.TestOvercloudUpgradeRun):
self.cmd.take_action(parsed_args)
upgrade_ansible.assert_called_once_with(
self.app.client_manager,
container='overcloud',
nodes='Compute, Controller',
inventory_file=mock_open().__enter__().read(),
playbook='fake-playbook.yaml',
@ -217,6 +218,7 @@ class TestOvercloudUpgradeRun(fakes.TestOvercloudUpgradeRun):
for book in constants.MAJOR_UPGRADE_PLAYBOOKS:
upgrade_ansible.assert_any_call(
self.app.client_manager,
container='overcloud',
nodes='Compute',
inventory_file=mock_open().__enter__().read(),
playbook=book,
@ -251,6 +253,7 @@ class TestOvercloudUpgradeRun(fakes.TestOvercloudUpgradeRun):
for book in constants.MAJOR_UPGRADE_PLAYBOOKS:
upgrade_ansible.assert_any_call(
self.app.client_manager,
container='overcloud',
nodes='Compute',
inventory_file=mock_open().__enter__().read(),
playbook=book,
@ -283,6 +286,7 @@ class TestOvercloudUpgradeRun(fakes.TestOvercloudUpgradeRun):
self.cmd.take_action(parsed_args)
upgrade_ansible.assert_called_once_with(
self.app.client_manager,
container='overcloud',
nodes='compute-0, compute-1',
inventory_file=mock_open().__enter__().read(),
playbook='fake-playbook.yaml',
@ -315,6 +319,7 @@ class TestOvercloudUpgradeRun(fakes.TestOvercloudUpgradeRun):
for book in constants.MAJOR_UPGRADE_PLAYBOOKS:
upgrade_ansible.assert_any_call(
self.app.client_manager,
container='overcloud',
nodes='swift-1',
inventory_file=mock_open().__enter__().read(),
playbook=book,
@ -349,6 +354,7 @@ class TestOvercloudUpgradeRun(fakes.TestOvercloudUpgradeRun):
for book in constants.MAJOR_UPGRADE_PLAYBOOKS:
upgrade_ansible.assert_any_call(
self.app.client_manager,
container='overcloud',
nodes='swift-1',
inventory_file=mock_open().__enter__().read(),
playbook=book,

View File

@ -1175,7 +1175,7 @@ def process_multiple_environments(created_env_files, tht_root,
return env_files, localenv
def run_update_ansible_action(log, clients, nodes, inventory,
def run_update_ansible_action(log, clients, stack, nodes, inventory,
playbook, all_playbooks, ssh_user,
action=None, tags='', skip_tags='',
verbosity='1', extra_vars=None,
@ -1187,7 +1187,7 @@ def run_update_ansible_action(log, clients, nodes, inventory,
for book in playbooks:
log.debug("Running ansible playbook %s " % book)
if action:
action.update_ansible(clients, nodes=nodes,
action.update_ansible(clients, container=stack, nodes=nodes,
inventory_file=inventory,
playbook=book, node_user=ssh_user,
tags=tags, skip_tags=skip_tags,

View File

@ -117,7 +117,7 @@ class ExternalUpdateRun(command.Command):
extra_vars = oooutils.parse_extra_vars(parsed_args.extra_vars)
oooutils.run_update_ansible_action(
self.log, clients, limit_hosts, inventory, playbook,
self.log, clients, stack, limit_hosts, inventory, playbook,
constants.EXTERNAL_UPDATE_PLAYBOOKS, parsed_args.ssh_user,
(None if parsed_args.no_workflow else package_update),
tags=parsed_args.tags, skip_tags=parsed_args.skip_tags,

View File

@ -117,7 +117,7 @@ class ExternalUpgradeRun(command.Command):
extra_vars = oooutils.parse_extra_vars(parsed_args.extra_vars)
oooutils.run_update_ansible_action(
self.log, clients, limit_hosts, inventory, playbook,
self.log, clients, stack, limit_hosts, inventory, playbook,
constants.EXTERNAL_UPGRADE_PLAYBOOKS, parsed_args.ssh_user,
(None if parsed_args.no_workflow else package_update),
tags=parsed_args.tags, skip_tags=parsed_args.skip_tags,

View File

@ -171,7 +171,7 @@ class FFWDUpgradeRun(command.Command):
# Don't expost limit_hosts. We need this on the whole overcloud.
limit_hosts = ''
oooutils.run_update_ansible_action(
self.log, clients, limit_hosts, inventory,
self.log, clients, parsed_args.stack, limit_hosts, inventory,
constants.FFWD_UPGRADE_PLAYBOOK, [], parsed_args.ssh_user,
(None if parsed_args.no_workflow else package_update),
verbosity=verbosity, workdir=ansible_dir, priv_key=key)

View File

@ -160,8 +160,8 @@ class UpdateRun(command.Command):
playbook = parsed_args.playbook
inventory = oooutils.get_tripleo_ansible_inventory(
parsed_args.static_inventory, parsed_args.ssh_user, stack)
oooutils.run_update_ansible_action(self.log, clients, limit_hosts,
inventory, playbook,
oooutils.run_update_ansible_action(self.log, clients, stack,
limit_hosts, inventory, playbook,
constants.MINOR_UPDATE_PLAYBOOKS,
parsed_args.ssh_user,
(None if parsed_args.no_workflow

View File

@ -215,8 +215,8 @@ class UpgradeRun(command.Command):
inventory = oooutils.get_tripleo_ansible_inventory(
parsed_args.static_inventory, parsed_args.ssh_user, stack)
skip_tags = self._validate_skip_tags(parsed_args.skip_tags)
oooutils.run_update_ansible_action(self.log, clients, limit_hosts,
inventory, playbook,
oooutils.run_update_ansible_action(self.log, clients, stack,
limit_hosts, inventory, playbook,
constants.MAJOR_UPGRADE_PLAYBOOKS,
parsed_args.ssh_user,
(None if parsed_args.no_workflow