Merge "Add '--templates' arg to node and net provision"

This commit is contained in:
Zuul 2021-07-02 21:27:27 +00:00 committed by Gerrit Code Review
commit 2b0038efc0
6 changed files with 44 additions and 14 deletions

View File

@ -1478,11 +1478,13 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
arglist = [ arglist = [
'--baremetal-deployment', bm_deploy_path, '--baremetal-deployment', bm_deploy_path,
'--overcloud-ssh-key', ssh_key_path '--overcloud-ssh-key', ssh_key_path,
'--templates', constants.TRIPLEO_HEAT_TEMPLATES,
] ]
verifylist = [ verifylist = [
('baremetal_deployment', bm_deploy_path), ('baremetal_deployment', bm_deploy_path),
('overcloud_ssh_key', ssh_key_path), ('overcloud_ssh_key', ssh_key_path),
('templates', constants.TRIPLEO_HEAT_TEMPLATES)
] ]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -1512,7 +1514,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
'ssh_private_key_file': self.tmp_dir.join('id_rsa.pub'), 'ssh_private_key_file': self.tmp_dir.join('id_rsa.pub'),
'manage_network_ports': False, 'manage_network_ports': False,
'configure_networking': False, 'configure_networking': False,
'working_dir': self.tmp_dir.join('working_dir') 'working_dir': self.tmp_dir.join('working_dir'),
'templates': constants.TRIPLEO_HEAT_TEMPLATES,
}, },
inventory='localhost,', inventory='localhost,',
playbook='cli-overcloud-node-provision.yaml', playbook='cli-overcloud-node-provision.yaml',
@ -1546,8 +1549,10 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
with open(networks_file_path, 'w') as temp_file: with open(networks_file_path, 'w') as temp_file:
yaml.safe_dump(network_data, temp_file) yaml.safe_dump(network_data, temp_file)
arglist = ['--networks-file', networks_file_path] arglist = ['--networks-file', networks_file_path,
verifylist = [('networks_file', networks_file_path)] '--templates', constants.TRIPLEO_HEAT_TEMPLATES]
verifylist = [('networks_file', networks_file_path),
('templates', constants.TRIPLEO_HEAT_TEMPLATES)]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
tht_root = self.tmp_dir.join('tht') tht_root = self.tmp_dir.join('tht')
@ -1560,7 +1565,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
self.mock_playbook.assert_called_once_with( self.mock_playbook.assert_called_once_with(
extra_vars={'network_data_path': networks_file_path, extra_vars={'network_data_path': networks_file_path,
'network_deployed_path': env_path, 'network_deployed_path': env_path,
'overwrite': True}, 'overwrite': True,
'templates': constants.TRIPLEO_HEAT_TEMPLATES},
inventory='localhost,', inventory='localhost,',
playbook='cli-overcloud-network-provision.yaml', playbook='cli-overcloud-network-provision.yaml',
playbook_dir='/usr/share/ansible/tripleo-playbooks', playbook_dir='/usr/share/ansible/tripleo-playbooks',
@ -1584,10 +1590,12 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
stack_name = 'overcloud' stack_name = 'overcloud'
arglist = ['--stack', stack_name, arglist = ['--stack', stack_name,
'--vip-file', vips_file_path, '--vip-file', vips_file_path,
'--networks-file', networks_file_path] '--networks-file', networks_file_path,
'--templates', constants.TRIPLEO_HEAT_TEMPLATES]
verifylist = [('stack', stack_name), verifylist = [('stack', stack_name),
('vip_file', vips_file_path), ('vip_file', vips_file_path),
('networks_file', networks_file_path)] ('networks_file', networks_file_path),
('templates', constants.TRIPLEO_HEAT_TEMPLATES)]
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
tht_root = self.tmp_dir.join('tht') tht_root = self.tmp_dir.join('tht')
@ -1601,7 +1609,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
extra_vars={'stack_name': stack_name, extra_vars={'stack_name': stack_name,
'vip_data_path': vips_file_path, 'vip_data_path': vips_file_path,
'vip_deployed_path': env_path, 'vip_deployed_path': env_path,
'overwrite': True}, 'overwrite': True,
'templates': constants.TRIPLEO_HEAT_TEMPLATES},
inventory='localhost,', inventory='localhost,',
playbook='cli-overcloud-network-vip-provision.yaml', playbook='cli-overcloud-network-vip-provision.yaml',
playbook_dir='/usr/share/ansible/tripleo-playbooks', playbook_dir='/usr/share/ansible/tripleo-playbooks',

View File

@ -17,6 +17,7 @@ import mock
from osc_lib import exceptions as osc_lib_exc from osc_lib import exceptions as osc_lib_exc
from tripleoclient import constants
from tripleoclient.tests import fakes from tripleoclient.tests import fakes
from tripleoclient.v2 import overcloud_network from tripleoclient.v2 import overcloud_network
@ -102,7 +103,8 @@ class TestOvercloudNetworkProvision(fakes.FakePlaybookExecution):
extra_vars={ extra_vars={
"network_data_path": '/test/network_data_v2.yaml', "network_data_path": '/test/network_data_v2.yaml',
"network_deployed_path": '/test/deployed_networks.yaml', "network_deployed_path": '/test/deployed_networks.yaml',
"overwrite": True "overwrite": True,
'templates': constants.TRIPLEO_HEAT_TEMPLATES,
} }
) )

View File

@ -354,6 +354,7 @@ class TestProvisionNode(fakes.TestOvercloudNode):
'manage_network_ports': False, 'manage_network_ports': False,
'configure_networking': False, 'configure_networking': False,
'working_dir': mock.ANY, 'working_dir': mock.ANY,
'templates': constants.TRIPLEO_HEAT_TEMPLATES,
}, },
inventory='localhost,', inventory='localhost,',
playbook='cli-overcloud-node-provision.yaml', playbook='cli-overcloud-node-provision.yaml',
@ -411,7 +412,7 @@ class TestUnprovisionNode(fakes.TestOvercloudNode):
playbook='cli-overcloud-node-unprovision.yaml', playbook='cli-overcloud-node-unprovision.yaml',
playbook_dir='/usr/share/ansible/tripleo-playbooks', playbook_dir='/usr/share/ansible/tripleo-playbooks',
verbosity=mock.ANY, verbosity=mock.ANY,
workdir=tmp workdir=tmp,
), ),
mock.call( mock.call(
extra_vars={ extra_vars={

View File

@ -454,7 +454,8 @@ class DeployOvercloud(command.Command):
"manage_network_ports": (parsed_args.network_ports "manage_network_ports": (parsed_args.network_ports
or parsed_args.network_config), or parsed_args.network_config),
"configure_networking": parsed_args.network_config, "configure_networking": parsed_args.network_config,
"working_dir": self.working_dir "working_dir": self.working_dir,
"templates": parsed_args.templates,
} }
with utils.TempDirs() as tmp: with utils.TempDirs() as tmp:
@ -512,6 +513,7 @@ class DeployOvercloud(command.Command):
"network_data_path": networks_file_path, "network_data_path": networks_file_path,
"network_deployed_path": output_path, "network_deployed_path": output_path,
"overwrite": True, "overwrite": True,
"templates": parsed_args.templates,
} }
with utils.TempDirs() as tmp: with utils.TempDirs() as tmp:
@ -543,6 +545,7 @@ class DeployOvercloud(command.Command):
"vip_data_path": vip_file_path, "vip_data_path": vip_file_path,
"vip_deployed_path": output_path, "vip_deployed_path": output_path,
"overwrite": True, "overwrite": True,
"templates": parsed_args.templates,
} }
with utils.TempDirs() as tmp: with utils.TempDirs() as tmp:

View File

@ -96,6 +96,10 @@ class OvercloudNetworkProvision(command.Command):
parser.add_argument('-y', '--yes', default=False, action='store_true', parser.add_argument('-y', '--yes', default=False, action='store_true',
help=_('Skip yes/no prompt for existing files ' help=_('Skip yes/no prompt for existing files '
'(assume yes).')) '(assume yes).'))
parser.add_argument('--templates',
help=_("The directory containing the Heat "
"templates to deploy"),
default=constants.TRIPLEO_HEAT_TEMPLATES)
return parser return parser
@ -123,7 +127,8 @@ class OvercloudNetworkProvision(command.Command):
extra_vars = { extra_vars = {
"network_data_path": networks_file_path, "network_data_path": networks_file_path,
"network_deployed_path": output_path, "network_deployed_path": output_path,
"overwrite": overwrite "overwrite": overwrite,
"templates": parsed_args.templates,
} }
with oooutils.TempDirs() as tmp: with oooutils.TempDirs() as tmp:
@ -214,6 +219,10 @@ class OvercloudVirtualIPsProvision(command.Command):
parser.add_argument('-y', '--yes', default=False, action='store_true', parser.add_argument('-y', '--yes', default=False, action='store_true',
help=_('Skip yes/no prompt for existing files ' help=_('Skip yes/no prompt for existing files '
'(assume yes).')) '(assume yes).'))
parser.add_argument('--templates',
help=_("The directory containing the Heat "
"templates to deploy"),
default=constants.TRIPLEO_HEAT_TEMPLATES)
return parser return parser
@ -242,7 +251,8 @@ class OvercloudVirtualIPsProvision(command.Command):
"stack_name": parsed_args.stack, "stack_name": parsed_args.stack,
"vip_data_path": vip_file_path, "vip_data_path": vip_file_path,
"vip_deployed_path": output_path, "vip_deployed_path": output_path,
"overwrite": overwrite "overwrite": overwrite,
"templates": parsed_args.templates,
} }
with oooutils.TempDirs() as tmp: with oooutils.TempDirs() as tmp:

View File

@ -262,6 +262,10 @@ class ProvisionNode(command.Command):
'nodes. (Implies "--network-ports")'), 'nodes. (Implies "--network-ports")'),
default=False, default=False,
action="store_true") action="store_true")
parser.add_argument('--templates',
help=_("The directory containing the Heat "
"templates to deploy"),
default=constants.TRIPLEO_HEAT_TEMPLATES)
parser.add_argument( parser.add_argument(
'--working-dir', action='store', '--working-dir', action='store',
help=_('The working directory for the deployment where all ' help=_('The working directory for the deployment where all '
@ -314,7 +318,8 @@ class ProvisionNode(command.Command):
"manage_network_ports": (parsed_args.network_ports "manage_network_ports": (parsed_args.network_ports
or parsed_args.network_config), or parsed_args.network_config),
"configure_networking": parsed_args.network_config, "configure_networking": parsed_args.network_config,
"working_dir": working_dir "working_dir": working_dir,
"templates": parsed_args.templates,
} }
with oooutils.TempDirs() as tmp: with oooutils.TempDirs() as tmp: