Add -n/--networks-data option
This allows overriding the default network_data.yaml, similar to the existing interface for roles_data.yaml. Change-Id: I0a7fa4538702c61169a6760b10dbc4f5137bd9ec Partially-Implements: blueprint composable-networks
This commit is contained in:
parent
b1df493d43
commit
112dbb1075
@ -0,0 +1,6 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
A new -n/--networks-data option has been added. This allows overriding the
|
||||
default network_data.yaml, similar to the existing interface for
|
||||
roles_data.yaml.
|
@ -34,6 +34,7 @@ SERVICE_LIST = {
|
||||
TRIPLEO_HEAT_TEMPLATES = "/usr/share/openstack-tripleo-heat-templates/"
|
||||
OVERCLOUD_YAML_NAME = "overcloud.yaml"
|
||||
OVERCLOUD_ROLES_FILE = "roles_data.yaml"
|
||||
OVERCLOUD_NETWORKS_FILE = "network_data.yaml"
|
||||
RHEL_REGISTRATION_EXTRACONFIG_NAME = (
|
||||
"extraconfig/pre_deploy/rhel-registration/")
|
||||
|
||||
|
@ -398,12 +398,14 @@ class DeployOvercloud(command.Command):
|
||||
plan_management.update_plan_from_templates(
|
||||
self.clients, parsed_args.stack, tht_root,
|
||||
parsed_args.roles_file, generate_passwords,
|
||||
parsed_args.plan_environment_file)
|
||||
parsed_args.plan_environment_file,
|
||||
parsed_args.networks_file)
|
||||
else:
|
||||
plan_management.create_plan_from_templates(
|
||||
self.clients, parsed_args.stack, tht_root,
|
||||
parsed_args.roles_file, generate_passwords,
|
||||
parsed_args.plan_environment_file)
|
||||
parsed_args.plan_environment_file,
|
||||
parsed_args.networks_file)
|
||||
|
||||
# Get any missing (e.g j2 rendered) files from the plan to tht_root
|
||||
self._download_missing_files_from_plan(
|
||||
@ -714,6 +716,11 @@ class DeployOvercloud(command.Command):
|
||||
help=_('Roles file, overrides the default %s in the --templates '
|
||||
'directory') % constants.OVERCLOUD_ROLES_FILE
|
||||
)
|
||||
parser.add_argument(
|
||||
'--networks-file', '-n', dest='networks_file',
|
||||
help=_('Networks file, overrides the default %s in the '
|
||||
'--templates directory') % constants.OVERCLOUD_NETWORKS_FILE
|
||||
)
|
||||
parser.add_argument(
|
||||
'--plan-environment-file', '-p',
|
||||
help=_('Plan Environment file, overrides the default %s in the '
|
||||
|
@ -31,7 +31,7 @@ _WORKFLOW_TIMEOUT = 360 # 6 * 60 seconds
|
||||
|
||||
|
||||
def _upload_templates(swift_client, container_name, tht_root, roles_file=None,
|
||||
plan_env_file=None):
|
||||
plan_env_file=None, networks_file=None):
|
||||
"""tarball up a given directory and upload it to Swift to be extracted"""
|
||||
|
||||
with tempfile.NamedTemporaryFile() as tmp_tarball:
|
||||
@ -45,6 +45,14 @@ def _upload_templates(swift_client, container_name, tht_root, roles_file=None,
|
||||
swift_client.put_object(container_name,
|
||||
constants.OVERCLOUD_ROLES_FILE,
|
||||
rf)
|
||||
|
||||
# Allow optional override of the network_data.yaml file
|
||||
if networks_file:
|
||||
with open(networks_file) as rf:
|
||||
swift_client.put_object(container_name,
|
||||
constants.OVERCLOUD_NETWORKS_FILE,
|
||||
rf)
|
||||
|
||||
# Optional override of the plan-environment.yaml file
|
||||
if plan_env_file:
|
||||
# TODO(jpalanis): Instead of overriding default file,
|
||||
@ -140,7 +148,8 @@ def create_container(workflow_client, **input_):
|
||||
|
||||
|
||||
def create_plan_from_templates(clients, name, tht_root, roles_file=None,
|
||||
generate_passwords=True, plan_env_file=None):
|
||||
generate_passwords=True, plan_env_file=None,
|
||||
networks_file=None):
|
||||
workflow_client = clients.workflow_engine
|
||||
swift_client = clients.tripleoclient.object_store
|
||||
|
||||
@ -153,7 +162,8 @@ def create_plan_from_templates(clients, name, tht_root, roles_file=None,
|
||||
"Unable to create plan. {}".format(result))
|
||||
|
||||
print("Creating plan from template files in: {}".format(tht_root))
|
||||
_upload_templates(swift_client, name, tht_root, roles_file, plan_env_file)
|
||||
_upload_templates(swift_client, name, tht_root, roles_file, plan_env_file,
|
||||
networks_file)
|
||||
|
||||
try:
|
||||
create_deployment_plan(clients, container=name,
|
||||
@ -165,7 +175,8 @@ def create_plan_from_templates(clients, name, tht_root, roles_file=None,
|
||||
|
||||
|
||||
def update_plan_from_templates(clients, name, tht_root, roles_file=None,
|
||||
generate_passwords=True, plan_env_file=None):
|
||||
generate_passwords=True, plan_env_file=None,
|
||||
networks_file=None):
|
||||
swift_client = clients.tripleoclient.object_store
|
||||
|
||||
# If the plan environment was migrated to Swift, save the generated
|
||||
@ -196,7 +207,8 @@ def update_plan_from_templates(clients, name, tht_root, roles_file=None,
|
||||
# need to special-case plan-environment.yaml to avoid this.
|
||||
|
||||
print("Uploading new plan files")
|
||||
_upload_templates(swift_client, name, tht_root, roles_file, plan_env_file)
|
||||
_upload_templates(swift_client, name, tht_root, roles_file, plan_env_file,
|
||||
networks_file)
|
||||
_update_passwords(swift_client, name, passwords)
|
||||
update_deployment_plan(clients, container=name,
|
||||
queue_name=str(uuid.uuid4()),
|
||||
|
Loading…
Reference in New Issue
Block a user