Merge "node extract provisioned - warning no net_conf tpl" into stable/wallaby
This commit is contained in:
commit
72b2e4da86
@ -758,7 +758,6 @@ class TestExtractProvisionedNode(test_utils.TestCommand):
|
|||||||
'parameters': {
|
'parameters': {
|
||||||
'ComputeHostnameFormat': '%stackname%-novacompute-%index%',
|
'ComputeHostnameFormat': '%stackname%-novacompute-%index%',
|
||||||
'ControllerHostnameFormat': '%stackname%-controller-%index%',
|
'ControllerHostnameFormat': '%stackname%-controller-%index%',
|
||||||
'ComputeNetworkConfigTemplate': 'templates/compute.j2',
|
|
||||||
'ControllerNetworkConfigTemplate': 'templates/controller.j2'
|
'ControllerNetworkConfigTemplate': 'templates/controller.j2'
|
||||||
},
|
},
|
||||||
'outputs': [{
|
'outputs': [{
|
||||||
@ -935,7 +934,7 @@ class TestExtractProvisionedNode(test_utils.TestCommand):
|
|||||||
'network_config': {'network_config_update': False,
|
'network_config': {'network_config_update': False,
|
||||||
'physical_bridge_name': 'br-ex',
|
'physical_bridge_name': 'br-ex',
|
||||||
'public_interface_name': 'nic1',
|
'public_interface_name': 'nic1',
|
||||||
'template': 'templates/compute.j2'},
|
'template': None},
|
||||||
'networks': [{'network': 'ctlplane',
|
'networks': [{'network': 'ctlplane',
|
||||||
'vif': True},
|
'vif': True},
|
||||||
{'network': 'internal_api',
|
{'network': 'internal_api',
|
||||||
@ -979,7 +978,11 @@ class TestExtractProvisionedNode(test_utils.TestCommand):
|
|||||||
}], yaml.safe_load(result))
|
}], yaml.safe_load(result))
|
||||||
|
|
||||||
with open(self.extract_file.name) as f:
|
with open(self.extract_file.name) as f:
|
||||||
self.assertEqual(yaml.safe_load(result), yaml.safe_load(f))
|
file_content = f.read()
|
||||||
|
self.assertEqual(yaml.safe_load(result), yaml.safe_load(file_content))
|
||||||
|
self.assertIn('# WARNING: No network config found for role Compute. '
|
||||||
|
'Please edit the file and set the path to the correct '
|
||||||
|
'network config template.\n', file_content)
|
||||||
|
|
||||||
def test_extract_ips_from_pool(self):
|
def test_extract_ips_from_pool(self):
|
||||||
stack = mock.Mock()
|
stack = mock.Mock()
|
||||||
@ -1016,7 +1019,7 @@ class TestExtractProvisionedNode(test_utils.TestCommand):
|
|||||||
'network_config': {'network_config_update': False,
|
'network_config': {'network_config_update': False,
|
||||||
'physical_bridge_name': 'br-ex',
|
'physical_bridge_name': 'br-ex',
|
||||||
'public_interface_name': 'nic1',
|
'public_interface_name': 'nic1',
|
||||||
'template': 'templates/compute.j2'},
|
'template': None},
|
||||||
'networks': [{'network': 'ctlplane',
|
'networks': [{'network': 'ctlplane',
|
||||||
'vif': True},
|
'vif': True},
|
||||||
{'network': 'internal_api',
|
{'network': 'internal_api',
|
||||||
|
@ -566,6 +566,7 @@ class ExtractProvisionedNode(command.Command):
|
|||||||
hostname_node_resource[hostname] = node.resource_class
|
hostname_node_resource[hostname] = node.resource_class
|
||||||
|
|
||||||
data = []
|
data = []
|
||||||
|
warnings = []
|
||||||
for role_name, entries in host_vars.items():
|
for role_name, entries in host_vars.items():
|
||||||
role_count = len(entries)
|
role_count = len(entries)
|
||||||
|
|
||||||
@ -604,6 +605,11 @@ class ExtractProvisionedNode(command.Command):
|
|||||||
net_conf = defaults['network_config'] = {}
|
net_conf = defaults['network_config'] = {}
|
||||||
net_conf['template'] = parameters.get(
|
net_conf['template'] = parameters.get(
|
||||||
role_name + 'NetworkConfigTemplate')
|
role_name + 'NetworkConfigTemplate')
|
||||||
|
if net_conf['template'] is None:
|
||||||
|
warnings.append(
|
||||||
|
'WARNING: No network config found for role {}. Please '
|
||||||
|
'edit the file and set the path to the correct network '
|
||||||
|
'config template.'.format(role_name))
|
||||||
|
|
||||||
if parameters.get(role_name + 'NetworkDeploymentActions'):
|
if parameters.get(role_name + 'NetworkDeploymentActions'):
|
||||||
network_deployment_actions = parameters.get(
|
network_deployment_actions = parameters.get(
|
||||||
@ -668,6 +674,11 @@ class ExtractProvisionedNode(command.Command):
|
|||||||
datetime.datetime.now().isoformat())
|
datetime.datetime.now().isoformat())
|
||||||
file_data.write('# openstack %s\n#\n\n' %
|
file_data.write('# openstack %s\n#\n\n' %
|
||||||
' '.join(self.app.command_options))
|
' '.join(self.app.command_options))
|
||||||
|
# Write any warnings in the file header
|
||||||
|
for warning in warnings:
|
||||||
|
file_data.write('# {}\n'.format(warning))
|
||||||
|
if warnings:
|
||||||
|
file_data.write(('#\n\n'))
|
||||||
# Write the data
|
# Write the data
|
||||||
if data:
|
if data:
|
||||||
yaml.dump(data, file_data, RoleDataDumper, width=120,
|
yaml.dump(data, file_data, RoleDataDumper, width=120,
|
||||||
|
Loading…
Reference in New Issue
Block a user