From 71ebf2a31ecaee96342599c2d14ee5325d6d6413 Mon Sep 17 00:00:00 2001 From: Jiri Stransky Date: Fri, 14 Oct 2016 17:15:33 +0200 Subject: [PATCH] Allow overriding CLI parameter defaults with env files We've added the ability to override CLI defaults with environment files [1] but then it got reversed while fixing a related bug [2]. We need to put this ability back because otherwise we cannot customize e.g. NeutronDhcpAgentsPerNetwork, or deploy with external Ceph with custom FSID and key. As a related change we have to remove hardcoded role counts from overcloud-env.json, because they'd overwrite the counts passed via CLI. (Furthermore, having the hardcoded default counts there doesn't make too much sense now that we have custom roles, the counts should already be properly defaulted in role_data.yaml.) [1] Change ID I2722e118abde1cea6210148b16ac1ed3d9f235d8 [2] Change ID I80c663c23dfa27fa7b4ca2bf6b0101c132e5889b Closes-Bug: #1632683 Change-Id: Iaf0adda44c84fcc552e743e4712d1dcf01daa7e4 --- tripleoclient/utils.py | 34 ++++------------------------ tripleoclient/v1/overcloud_deploy.py | 6 ++--- 2 files changed, 7 insertions(+), 33 deletions(-) diff --git a/tripleoclient/utils.py b/tripleoclient/utils.py index e884ceb2c..a3b85402f 100644 --- a/tripleoclient/utils.py +++ b/tripleoclient/utils.py @@ -378,40 +378,16 @@ def wait_for_provision_state(baremetal_client, node_uuid, provision_state, ) -def create_environment_file(path="~/overcloud-env.json", - control_scale=1, compute_scale=1, - ceph_storage_scale=0, block_storage_scale=0, - swift_storage_scale=0): - """Create a heat environment file +def create_environment_file(path="~/overcloud-env.json"): + """Create a blank heat environment file - Create the heat environment file with the scale parameters. - - :param control_scale: Scale value for control roles. - :type control_scale: int - - :param compute_scale: Scale value for compute roles. - :type compute_scale: int - - :param ceph_storage_scale: Scale value for ceph storage roles. - :type ceph_storage_scale: int - - :param block_storage_scale: Scale value for block storage roles. - :type block_storage_scale: int - - :param swift_storage_scale: Scale value for swift storage roles. - :type swift_storage_scale: int + Create a Heat environment file for supplying initial parameter + values when deploying overcloud """ env_path = os.path.expanduser(path) with open(env_path, 'w+') as f: - f.write(json.dumps({ - "parameter_defaults": { - "ControllerCount": control_scale, - "ComputeCount": compute_scale, - "CephStorageCount": ceph_storage_scale, - "BlockStorageCount": block_storage_scale, - "ObjectStorageCount": swift_storage_scale} - })) + f.write(json.dumps({"parameter_defaults": {}})) return env_path diff --git a/tripleoclient/v1/overcloud_deploy.py b/tripleoclient/v1/overcloud_deploy.py index 054bf73ae..a2032bc14 100644 --- a/tripleoclient/v1/overcloud_deploy.py +++ b/tripleoclient/v1/overcloud_deploy.py @@ -540,13 +540,11 @@ class DeployOvercloud(command.Command): env_files, localenv = self._process_multiple_environments( created_env_files, added_files, tht_root, user_tht_root, cleanup=not parsed_args.no_cleanup) - - # Command line has more precedence than env files - template_utils.deep_update(localenv, env) + template_utils.deep_update(env, localenv) self._try_overcloud_deploy_with_compat_yaml( tht_root, stack, parsed_args.stack, parameters, env_files, - parsed_args.timeout, localenv) + parsed_args.timeout, env) def _try_overcloud_deploy_with_compat_yaml(self, tht_root, stack, stack_name, parameters,