Merge "node provision, Set vars for generating inventory"

changes/07/777307/1
Zuul 2 years ago committed by Gerrit Code Review
commit 42aa7357fb
  1. 3
      tripleoclient/tests/v2/overcloud_node/test_overcloud_node.py
  2. 16
      tripleoclient/v2/overcloud_node.py

@ -325,6 +325,7 @@ class TestProvisionNode(fakes.TestOvercloudNode):
keyf.flush()
with open('{}.pub'.format(keyf.name), 'w') as f:
f.write('I am a key')
key_file_name = keyf.name
argslist = ['--output', outp.name,
'--overcloud-ssh-key', keyf.name,
@ -347,9 +348,11 @@ class TestProvisionNode(fakes.TestOvercloudNode):
'baremetal_deployed_path': mock.ANY,
'ssh_public_keys': 'I am a key',
'ssh_user_name': 'heat-admin',
'ssh_private_key_file': key_file_name,
'node_timeout': 3600,
'concurrency': 20,
'manage_network_ports': False,
'output_dir': mock.ANY,
},
inventory='localhost,',
playbook='cli-overcloud-node-provision.yaml',

@ -256,6 +256,13 @@ class ProvisionNode(command.Command):
help=_('Enable provisioning of network ports'),
default=False,
action="store_true")
parser.add_argument('--output-dir',
help=_('Directory to use for saved output. '
'When not specified, '
'$HOME/config-download/node-config will be '
'used.'),
action='store',
default=None)
return parser
def take_action(self, parsed_args):
@ -269,16 +276,23 @@ class ProvisionNode(command.Command):
ssh_key = fp.read()
output_path = os.path.abspath(parsed_args.output)
if parsed_args.output_dir:
output_dir = os.path.abspath(parsed_args.output_dir)
else:
output_dir = os.path.join(constants.DEFAULT_WORK_DIR,
'node-config')
extra_vars = {
"stack_name": parsed_args.stack,
"baremetal_deployment": roles,
"baremetal_deployed_path": output_path,
"ssh_public_keys": ssh_key,
"ssh_private_key_file": key,
"ssh_user_name": parsed_args.overcloud_ssh_user,
"node_timeout": parsed_args.timeout,
"concurrency": parsed_args.concurrency,
"manage_network_ports": parsed_args.network_ports
"manage_network_ports": parsed_args.network_ports,
"output_dir": output_dir
}
with oooutils.TempDirs() as tmp:

Loading…
Cancel
Save