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/"
|
TRIPLEO_HEAT_TEMPLATES = "/usr/share/openstack-tripleo-heat-templates/"
|
||||||
OVERCLOUD_YAML_NAME = "overcloud.yaml"
|
OVERCLOUD_YAML_NAME = "overcloud.yaml"
|
||||||
OVERCLOUD_ROLES_FILE = "roles_data.yaml"
|
OVERCLOUD_ROLES_FILE = "roles_data.yaml"
|
||||||
|
OVERCLOUD_NETWORKS_FILE = "network_data.yaml"
|
||||||
RHEL_REGISTRATION_EXTRACONFIG_NAME = (
|
RHEL_REGISTRATION_EXTRACONFIG_NAME = (
|
||||||
"extraconfig/pre_deploy/rhel-registration/")
|
"extraconfig/pre_deploy/rhel-registration/")
|
||||||
|
|
||||||
|
@ -398,12 +398,14 @@ class DeployOvercloud(command.Command):
|
|||||||
plan_management.update_plan_from_templates(
|
plan_management.update_plan_from_templates(
|
||||||
self.clients, parsed_args.stack, tht_root,
|
self.clients, parsed_args.stack, tht_root,
|
||||||
parsed_args.roles_file, generate_passwords,
|
parsed_args.roles_file, generate_passwords,
|
||||||
parsed_args.plan_environment_file)
|
parsed_args.plan_environment_file,
|
||||||
|
parsed_args.networks_file)
|
||||||
else:
|
else:
|
||||||
plan_management.create_plan_from_templates(
|
plan_management.create_plan_from_templates(
|
||||||
self.clients, parsed_args.stack, tht_root,
|
self.clients, parsed_args.stack, tht_root,
|
||||||
parsed_args.roles_file, generate_passwords,
|
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
|
# Get any missing (e.g j2 rendered) files from the plan to tht_root
|
||||||
self._download_missing_files_from_plan(
|
self._download_missing_files_from_plan(
|
||||||
@ -714,6 +716,11 @@ class DeployOvercloud(command.Command):
|
|||||||
help=_('Roles file, overrides the default %s in the --templates '
|
help=_('Roles file, overrides the default %s in the --templates '
|
||||||
'directory') % constants.OVERCLOUD_ROLES_FILE
|
'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(
|
parser.add_argument(
|
||||||
'--plan-environment-file', '-p',
|
'--plan-environment-file', '-p',
|
||||||
help=_('Plan Environment file, overrides the default %s in the '
|
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,
|
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"""
|
"""tarball up a given directory and upload it to Swift to be extracted"""
|
||||||
|
|
||||||
with tempfile.NamedTemporaryFile() as tmp_tarball:
|
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,
|
swift_client.put_object(container_name,
|
||||||
constants.OVERCLOUD_ROLES_FILE,
|
constants.OVERCLOUD_ROLES_FILE,
|
||||||
rf)
|
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
|
# Optional override of the plan-environment.yaml file
|
||||||
if plan_env_file:
|
if plan_env_file:
|
||||||
# TODO(jpalanis): Instead of overriding default 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,
|
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
|
workflow_client = clients.workflow_engine
|
||||||
swift_client = clients.tripleoclient.object_store
|
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))
|
"Unable to create plan. {}".format(result))
|
||||||
|
|
||||||
print("Creating plan from template files in: {}".format(tht_root))
|
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:
|
try:
|
||||||
create_deployment_plan(clients, container=name,
|
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,
|
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
|
swift_client = clients.tripleoclient.object_store
|
||||||
|
|
||||||
# If the plan environment was migrated to Swift, save the generated
|
# 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.
|
# need to special-case plan-environment.yaml to avoid this.
|
||||||
|
|
||||||
print("Uploading new plan files")
|
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_passwords(swift_client, name, passwords)
|
||||||
update_deployment_plan(clients, container=name,
|
update_deployment_plan(clients, container=name,
|
||||||
queue_name=str(uuid.uuid4()),
|
queue_name=str(uuid.uuid4()),
|
||||||
|
Loading…
Reference in New Issue
Block a user