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

Allow setting '--templates', the path tot the THT root
directory. Environment files created by the node and
network provision commands will be created with the user
specified path to the THT root. Defaults to:
 /usr/share/openstack-tripleo-heat-templates/

Closes-Bug: #1932079
Depends-On: I9decd8fb9860cd17dc9e69b9970d9f9dabf11428
Change-Id: I5dd81788c08bb0d797190a5fb8bb120b7d8b4f32
changes/71/798371/3
Harald Jensås 2 years ago
parent 27d0309f3f
commit 9c997ff094

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

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

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

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

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

@ -262,6 +262,10 @@ class ProvisionNode(command.Command):
'nodes. (Implies "--network-ports")'),
default=False,
action="store_true")
parser.add_argument('--templates',
help=_("The directory containing the Heat "
"templates to deploy"),
default=constants.TRIPLEO_HEAT_TEMPLATES)
parser.add_argument(
'--working-dir', action='store',
help=_('The working directory for the deployment where all '
@ -314,7 +318,8 @@ class ProvisionNode(command.Command):
"manage_network_ports": (parsed_args.network_ports
or 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:

Loading…
Cancel
Save