From 87bd46651fd0cb13575e253367248d01c24b3339 Mon Sep 17 00:00:00 2001 From: Vitaly Gridnev Date: Fri, 3 Jul 2015 17:31:51 +0300 Subject: [PATCH] Allow to specify auto_security_group in default templates The aim of this patch is to provide ability to specify auto_security_group and security groups in default templates. Change-Id: I304f4965580a9737c826e2862a70970a53cd5db8 Closes-bug: 1470177 --- sahara/db/templates/api.py | 17 +++--- .../cdh/version_5_0_0/datanode.json | 4 +- .../cdh/version_5_0_0/namenode.json | 4 +- .../cdh/version_5_0_0/secondary-namenode.json | 4 +- .../cdh/version_5_3_0/datanode.json | 4 +- .../cdh/version_5_3_0/namenode.json | 4 +- .../cdh/version_5_3_0/secondary-namenode.json | 4 +- .../cdh/version_5_4_0/datanode.json | 4 +- .../cdh/version_5_4_0/namenode.json | 4 +- .../cdh/version_5_4_0/secondary-namenode.json | 4 +- .../hdp/version_2_0_6/master.json | 4 +- .../hdp/version_2_0_6/secondary-master.json | 4 +- .../hdp/version_2_0_6/worker.json | 4 +- .../default_templates/mapr/3_1_1/master.json | 4 +- .../default_templates/mapr/3_1_1/worker.json | 4 +- .../mapr/4_0_1_mrv1/master.json | 4 +- .../mapr/4_0_1_mrv1/worker.json | 4 +- .../mapr/4_0_1_mrv2/master.json | 4 +- .../mapr/4_0_1_mrv2/worker.json | 4 +- .../mapr/4_0_2_mrv2/master.json | 4 +- .../mapr/4_0_2_mrv2/worker.json | 4 +- .../default_templates/mapr/spark/master.json | 4 +- .../default_templates/mapr/spark/worker.json | 4 +- .../spark/v1_0_0/master.json | 4 +- .../default_templates/spark/v1_0_0/slave.json | 4 +- .../plugins/default_templates/template.conf | 1 + .../vanilla/v2_6_0/master.json | 4 +- .../vanilla/v2_6_0/secondary-master.json | 4 +- .../vanilla/v2_6_0/worker.json | 4 +- sahara/tests/unit/db/templates/test_update.py | 60 +++++++++++++------ 30 files changed, 134 insertions(+), 52 deletions(-) diff --git a/sahara/db/templates/api.py b/sahara/db/templates/api.py index aabad3a0..38f0f6a6 100644 --- a/sahara/db/templates/api.py +++ b/sahara/db/templates/api.py @@ -55,8 +55,14 @@ node_group_template_opts = [ help='Flavor id field for a node group template.'), cfg.StrOpt('floating_ip_pool', - help='Floating ip pool field for a node group template.') - ] + help='Floating ip pool field for a node group template.'), + cfg.BoolOpt('auto_security_group', + default=False, + help='Auto security group field for node group template.'), + cfg.ListOpt('security_groups', + default=[], + help='Security group field for node group template.') +] # Options that we allow to be replaced in a cluster template cluster_template_opts = [ @@ -260,12 +266,7 @@ def substitute_config_values(configs, template, path): for opt, value in six.iteritems(configs): if opt in opt_names and opt in template: - if value is None: - template[opt] = None - else: - # Use args to allow for keyword arguments to format - args = {opt: value} - template[opt] = template[opt].format(**args) + template[opt] = value def get_configs(section): diff --git a/sahara/plugins/default_templates/cdh/version_5_0_0/datanode.json b/sahara/plugins/default_templates/cdh/version_5_0_0/datanode.json index 3cfd2a82..b357a823 100644 --- a/sahara/plugins/default_templates/cdh/version_5_0_0/datanode.json +++ b/sahara/plugins/default_templates/cdh/version_5_0_0/datanode.json @@ -7,5 +7,7 @@ ], "name": "cdh-5-default-datanode", "floating_ip_pool": "{floating_ip_pool}", - "flavor_id": "{flavor_id}" + "flavor_id": "{flavor_id}", + "auto_security_group": "{auto_security_group}", + "security_groups": "{security_groups}" } diff --git a/sahara/plugins/default_templates/cdh/version_5_0_0/namenode.json b/sahara/plugins/default_templates/cdh/version_5_0_0/namenode.json index be9fbb1c..3d62368d 100644 --- a/sahara/plugins/default_templates/cdh/version_5_0_0/namenode.json +++ b/sahara/plugins/default_templates/cdh/version_5_0_0/namenode.json @@ -10,5 +10,7 @@ ], "name": "cdh-5-default-namenode", "floating_ip_pool": "{floating_ip_pool}", - "flavor_id": "{flavor_id}" + "flavor_id": "{flavor_id}", + "auto_security_group": "{auto_security_group}", + "security_groups": "{security_groups}" } diff --git a/sahara/plugins/default_templates/cdh/version_5_0_0/secondary-namenode.json b/sahara/plugins/default_templates/cdh/version_5_0_0/secondary-namenode.json index 4216a8e4..cdb97782 100644 --- a/sahara/plugins/default_templates/cdh/version_5_0_0/secondary-namenode.json +++ b/sahara/plugins/default_templates/cdh/version_5_0_0/secondary-namenode.json @@ -8,5 +8,7 @@ ], "name": "cdh-5-default-secondary-namenode", "floating_ip_pool": "{floating_ip_pool}", - "flavor_id": "{flavor_id}" + "flavor_id": "{flavor_id}", + "auto_security_group": "{auto_security_group}", + "security_groups": "{security_groups}" } diff --git a/sahara/plugins/default_templates/cdh/version_5_3_0/datanode.json b/sahara/plugins/default_templates/cdh/version_5_3_0/datanode.json index a583ec6a..a5e8b434 100644 --- a/sahara/plugins/default_templates/cdh/version_5_3_0/datanode.json +++ b/sahara/plugins/default_templates/cdh/version_5_3_0/datanode.json @@ -7,5 +7,7 @@ ], "name": "cdh-530-default-datanode", "floating_ip_pool": "{floating_ip_pool}", - "flavor_id": "{flavor_id}" + "flavor_id": "{flavor_id}", + "auto_security_group": "{auto_security_group}", + "security_groups": "{security_groups}" } diff --git a/sahara/plugins/default_templates/cdh/version_5_3_0/namenode.json b/sahara/plugins/default_templates/cdh/version_5_3_0/namenode.json index 859723a2..53f5b2f2 100644 --- a/sahara/plugins/default_templates/cdh/version_5_3_0/namenode.json +++ b/sahara/plugins/default_templates/cdh/version_5_3_0/namenode.json @@ -10,5 +10,7 @@ ], "name": "cdh-530-default-namenode", "floating_ip_pool": "{floating_ip_pool}", - "flavor_id": "{flavor_id}" + "flavor_id": "{flavor_id}", + "auto_security_group": "{auto_security_group}", + "security_groups": "{security_groups}" } diff --git a/sahara/plugins/default_templates/cdh/version_5_3_0/secondary-namenode.json b/sahara/plugins/default_templates/cdh/version_5_3_0/secondary-namenode.json index 5a52575f..c70516f0 100644 --- a/sahara/plugins/default_templates/cdh/version_5_3_0/secondary-namenode.json +++ b/sahara/plugins/default_templates/cdh/version_5_3_0/secondary-namenode.json @@ -8,5 +8,7 @@ ], "name": "cdh-530-default-secondary-namenode", "floating_ip_pool": "{floating_ip_pool}", - "flavor_id": "{flavor_id}" + "flavor_id": "{flavor_id}", + "auto_security_group": "{auto_security_group}", + "security_groups": "{security_groups}" } diff --git a/sahara/plugins/default_templates/cdh/version_5_4_0/datanode.json b/sahara/plugins/default_templates/cdh/version_5_4_0/datanode.json index 0652fe3d..fd9f61f7 100644 --- a/sahara/plugins/default_templates/cdh/version_5_4_0/datanode.json +++ b/sahara/plugins/default_templates/cdh/version_5_4_0/datanode.json @@ -7,5 +7,7 @@ ], "name": "cdh-540-default-datanode", "floating_ip_pool": "{floating_ip_pool}", - "flavor_id": "{flavor_id}" + "flavor_id": "{flavor_id}", + "auto_security_group": "{auto_security_group}", + "security_groups": "{security_groups}" } diff --git a/sahara/plugins/default_templates/cdh/version_5_4_0/namenode.json b/sahara/plugins/default_templates/cdh/version_5_4_0/namenode.json index 541bcc62..c9f5b05d 100644 --- a/sahara/plugins/default_templates/cdh/version_5_4_0/namenode.json +++ b/sahara/plugins/default_templates/cdh/version_5_4_0/namenode.json @@ -10,5 +10,7 @@ ], "name": "cdh-540-default-namenode", "floating_ip_pool": "{floating_ip_pool}", - "flavor_id": "{flavor_id}" + "flavor_id": "{flavor_id}", + "auto_security_group": "{auto_security_group}", + "security_groups": "{security_groups}" } diff --git a/sahara/plugins/default_templates/cdh/version_5_4_0/secondary-namenode.json b/sahara/plugins/default_templates/cdh/version_5_4_0/secondary-namenode.json index e7a7b0dc..c2ce2494 100644 --- a/sahara/plugins/default_templates/cdh/version_5_4_0/secondary-namenode.json +++ b/sahara/plugins/default_templates/cdh/version_5_4_0/secondary-namenode.json @@ -8,5 +8,7 @@ ], "name": "cdh-540-default-secondary-namenode", "floating_ip_pool": "{floating_ip_pool}", - "flavor_id": "{flavor_id}" + "flavor_id": "{flavor_id}", + "auto_security_group": "{auto_security_group}", + "security_groups": "{security_groups}" } diff --git a/sahara/plugins/default_templates/hdp/version_2_0_6/master.json b/sahara/plugins/default_templates/hdp/version_2_0_6/master.json index b02ce3c2..6a96a674 100644 --- a/sahara/plugins/default_templates/hdp/version_2_0_6/master.json +++ b/sahara/plugins/default_templates/hdp/version_2_0_6/master.json @@ -10,5 +10,7 @@ ], "name": "hdp-206-default-master", "floating_ip_pool": "{floating_ip_pool}", - "flavor_id": "{flavor_id}" + "flavor_id": "{flavor_id}", + "auto_security_group": "{auto_security_group}", + "security_groups": "{security_groups}" } diff --git a/sahara/plugins/default_templates/hdp/version_2_0_6/secondary-master.json b/sahara/plugins/default_templates/hdp/version_2_0_6/secondary-master.json index ad420a2e..3977de02 100644 --- a/sahara/plugins/default_templates/hdp/version_2_0_6/secondary-master.json +++ b/sahara/plugins/default_templates/hdp/version_2_0_6/secondary-master.json @@ -8,5 +8,7 @@ ], "name": "hdp-206-default-secondary-master", "floating_ip_pool": "{floating_ip_pool}", - "flavor_id": "{flavor_id}" + "flavor_id": "{flavor_id}", + "auto_security_group": "{auto_security_group}", + "security_groups": "{security_groups}" } diff --git a/sahara/plugins/default_templates/hdp/version_2_0_6/worker.json b/sahara/plugins/default_templates/hdp/version_2_0_6/worker.json index 39253925..3a6fdec0 100644 --- a/sahara/plugins/default_templates/hdp/version_2_0_6/worker.json +++ b/sahara/plugins/default_templates/hdp/version_2_0_6/worker.json @@ -7,5 +7,7 @@ ], "name": "hdp-206-default-worker", "floating_ip_pool": "{floating_ip_pool}", - "flavor_id": "{flavor_id}" + "flavor_id": "{flavor_id}", + "auto_security_group": "{auto_security_group}", + "security_groups": "{security_groups}" } diff --git a/sahara/plugins/default_templates/mapr/3_1_1/master.json b/sahara/plugins/default_templates/mapr/3_1_1/master.json index bf57fbc1..6e6d725d 100644 --- a/sahara/plugins/default_templates/mapr/3_1_1/master.json +++ b/sahara/plugins/default_templates/mapr/3_1_1/master.json @@ -11,5 +11,7 @@ ], "name": "mapr-311-default-master", "floating_ip_pool": "{floating_ip_pool}", - "flavor_id": "{flavor_id}" + "flavor_id": "{flavor_id}", + "auto_security_group": "{auto_security_group}", + "security_groups": "{security_groups}" } diff --git a/sahara/plugins/default_templates/mapr/3_1_1/worker.json b/sahara/plugins/default_templates/mapr/3_1_1/worker.json index a7751d34..84b97f61 100644 --- a/sahara/plugins/default_templates/mapr/3_1_1/worker.json +++ b/sahara/plugins/default_templates/mapr/3_1_1/worker.json @@ -7,5 +7,7 @@ ], "name": "mapr-311-default-worker", "floating_ip_pool": "{floating_ip_pool}", - "flavor_id": "{flavor_id}" + "flavor_id": "{flavor_id}", + "auto_security_group": "{auto_security_group}", + "security_groups": "{security_groups}" } diff --git a/sahara/plugins/default_templates/mapr/4_0_1_mrv1/master.json b/sahara/plugins/default_templates/mapr/4_0_1_mrv1/master.json index f8c608a8..76b4a7fd 100644 --- a/sahara/plugins/default_templates/mapr/4_0_1_mrv1/master.json +++ b/sahara/plugins/default_templates/mapr/4_0_1_mrv1/master.json @@ -11,5 +11,7 @@ ], "name": "mapr-401mr1-default-master", "floating_ip_pool": "{floating_ip_pool}", - "flavor_id": "{flavor_id}" + "flavor_id": "{flavor_id}", + "auto_security_group": "{auto_security_group}", + "security_groups": "{security_groups}" } diff --git a/sahara/plugins/default_templates/mapr/4_0_1_mrv1/worker.json b/sahara/plugins/default_templates/mapr/4_0_1_mrv1/worker.json index a0d73fc5..9cc04944 100644 --- a/sahara/plugins/default_templates/mapr/4_0_1_mrv1/worker.json +++ b/sahara/plugins/default_templates/mapr/4_0_1_mrv1/worker.json @@ -7,5 +7,7 @@ ], "name": "mapr-401mr1-default-worker", "floating_ip_pool": "{floating_ip_pool}", - "flavor_id": "{flavor_id}" + "flavor_id": "{flavor_id}", + "auto_security_group": "{auto_security_group}", + "security_groups": "{security_groups}" } diff --git a/sahara/plugins/default_templates/mapr/4_0_1_mrv2/master.json b/sahara/plugins/default_templates/mapr/4_0_1_mrv2/master.json index 34c142aa..8c03f89c 100644 --- a/sahara/plugins/default_templates/mapr/4_0_1_mrv2/master.json +++ b/sahara/plugins/default_templates/mapr/4_0_1_mrv2/master.json @@ -12,5 +12,7 @@ ], "name": "mapr-401mr2-default-master", "floating_ip_pool": "{floating_ip_pool}", - "flavor_id": "{flavor_id}" + "flavor_id": "{flavor_id}", + "auto_security_group": "{auto_security_group}", + "security_groups": "{security_groups}" } diff --git a/sahara/plugins/default_templates/mapr/4_0_1_mrv2/worker.json b/sahara/plugins/default_templates/mapr/4_0_1_mrv2/worker.json index 0e0be7d4..daa095b0 100644 --- a/sahara/plugins/default_templates/mapr/4_0_1_mrv2/worker.json +++ b/sahara/plugins/default_templates/mapr/4_0_1_mrv2/worker.json @@ -7,5 +7,7 @@ ], "name": "mapr-401mr2-default-worker", "floating_ip_pool": "{floating_ip_pool}", - "flavor_id": "{flavor_id}" + "flavor_id": "{flavor_id}", + "auto_security_group": "{auto_security_group}", + "security_groups": "{security_groups}" } diff --git a/sahara/plugins/default_templates/mapr/4_0_2_mrv2/master.json b/sahara/plugins/default_templates/mapr/4_0_2_mrv2/master.json index 42bdca8c..04afb117 100644 --- a/sahara/plugins/default_templates/mapr/4_0_2_mrv2/master.json +++ b/sahara/plugins/default_templates/mapr/4_0_2_mrv2/master.json @@ -12,5 +12,7 @@ ], "name": "mapr-402mr2-default-master", "floating_ip_pool": "{floating_ip_pool}", - "flavor_id": "{flavor_id}" + "flavor_id": "{flavor_id}", + "auto_security_group": "{auto_security_group}", + "security_groups": "{security_groups}" } diff --git a/sahara/plugins/default_templates/mapr/4_0_2_mrv2/worker.json b/sahara/plugins/default_templates/mapr/4_0_2_mrv2/worker.json index d6fe6836..6c64d010 100644 --- a/sahara/plugins/default_templates/mapr/4_0_2_mrv2/worker.json +++ b/sahara/plugins/default_templates/mapr/4_0_2_mrv2/worker.json @@ -7,5 +7,7 @@ ], "name": "mapr-402mr2-default-worker", "floating_ip_pool": "{floating_ip_pool}", - "flavor_id": "{flavor_id}" + "flavor_id": "{flavor_id}", + "auto_security_group": "{auto_security_group}", + "security_groups": "{security_groups}" } diff --git a/sahara/plugins/default_templates/mapr/spark/master.json b/sahara/plugins/default_templates/mapr/spark/master.json index 18542471..e0c69b89 100644 --- a/sahara/plugins/default_templates/mapr/spark/master.json +++ b/sahara/plugins/default_templates/mapr/spark/master.json @@ -11,5 +11,7 @@ ], "name": "mapr-spark-default-master", "floating_ip_pool": "{floating_ip_pool}", - "flavor_id": "{flavor_id}" + "flavor_id": "{flavor_id}", + "auto_security_group": "{auto_security_group}", + "security_groups": "{security_groups}" } diff --git a/sahara/plugins/default_templates/mapr/spark/worker.json b/sahara/plugins/default_templates/mapr/spark/worker.json index 15e7f253..ae792873 100644 --- a/sahara/plugins/default_templates/mapr/spark/worker.json +++ b/sahara/plugins/default_templates/mapr/spark/worker.json @@ -7,5 +7,7 @@ ], "name": "mapr-spark-default-worker", "floating_ip_pool": "{floating_ip_pool}", - "flavor_id": "{flavor_id}" + "flavor_id": "{flavor_id}", + "auto_security_group": "{auto_security_group}", + "security_groups": "{security_groups}" } diff --git a/sahara/plugins/default_templates/spark/v1_0_0/master.json b/sahara/plugins/default_templates/spark/v1_0_0/master.json index b75a7de5..2e1ade8b 100644 --- a/sahara/plugins/default_templates/spark/v1_0_0/master.json +++ b/sahara/plugins/default_templates/spark/v1_0_0/master.json @@ -7,5 +7,7 @@ ], "name": "spark-100-default-master", "floating_ip_pool": "{floating_ip_pool}", - "flavor_id": "{flavor_id}" + "flavor_id": "{flavor_id}", + "auto_security_group": "{auto_security_group}", + "security_groups": "{security_groups}" } diff --git a/sahara/plugins/default_templates/spark/v1_0_0/slave.json b/sahara/plugins/default_templates/spark/v1_0_0/slave.json index 788aefd3..5865566e 100644 --- a/sahara/plugins/default_templates/spark/v1_0_0/slave.json +++ b/sahara/plugins/default_templates/spark/v1_0_0/slave.json @@ -7,5 +7,7 @@ ], "name": "spark-100-default-slave", "floating_ip_pool": "{floating_ip_pool}", - "flavor_id": "{flavor_id}" + "flavor_id": "{flavor_id}", + "auto_security_group": "{auto_security_group}", + "security_groups": "{security_groups}" } diff --git a/sahara/plugins/default_templates/template.conf b/sahara/plugins/default_templates/template.conf index 0c1d51ee..097ff4dd 100644 --- a/sahara/plugins/default_templates/template.conf +++ b/sahara/plugins/default_templates/template.conf @@ -8,6 +8,7 @@ flavor_id = 2 # of the master node to 4 which is m1.large in the # default flavor set flavor_id = 4 +auto_security_group = true [cdh-530-default-namenode] # For the CDH plugin, version 5.3.0, set the flavor_id diff --git a/sahara/plugins/default_templates/vanilla/v2_6_0/master.json b/sahara/plugins/default_templates/vanilla/v2_6_0/master.json index 9e4cbc89..11edbe83 100644 --- a/sahara/plugins/default_templates/vanilla/v2_6_0/master.json +++ b/sahara/plugins/default_templates/vanilla/v2_6_0/master.json @@ -8,5 +8,7 @@ ], "name": "vanilla-260-default-master", "floating_ip_pool": "{floating_ip_pool}", - "flavor_id": "{flavor_id}" + "flavor_id": "{flavor_id}", + "auto_security_group": "{auto_security_group}", + "security_groups": "{security_groups}" } diff --git a/sahara/plugins/default_templates/vanilla/v2_6_0/secondary-master.json b/sahara/plugins/default_templates/vanilla/v2_6_0/secondary-master.json index 2e647c9f..0faec343 100644 --- a/sahara/plugins/default_templates/vanilla/v2_6_0/secondary-master.json +++ b/sahara/plugins/default_templates/vanilla/v2_6_0/secondary-master.json @@ -8,5 +8,7 @@ ], "name": "vanilla-260-default-secondary-master", "floating_ip_pool": "{floating_ip_pool}", - "flavor_id": "{flavor_id}" + "flavor_id": "{flavor_id}", + "auto_security_group": "{auto_security_group}", + "security_groups": "{security_groups}" } diff --git a/sahara/plugins/default_templates/vanilla/v2_6_0/worker.json b/sahara/plugins/default_templates/vanilla/v2_6_0/worker.json index 130d93d8..93534dc5 100644 --- a/sahara/plugins/default_templates/vanilla/v2_6_0/worker.json +++ b/sahara/plugins/default_templates/vanilla/v2_6_0/worker.json @@ -7,5 +7,7 @@ ], "name": "vanilla-260-default-worker", "floating_ip_pool": "{floating_ip_pool}", - "flavor_id": "{flavor_id}" + "flavor_id": "{flavor_id}", + "auto_security_group": "{auto_security_group}", + "security_groups": "{security_groups}" } diff --git a/sahara/tests/unit/db/templates/test_update.py b/sahara/tests/unit/db/templates/test_update.py index d1739da9..1ef91b6c 100644 --- a/sahara/tests/unit/db/templates/test_update.py +++ b/sahara/tests/unit/db/templates/test_update.py @@ -57,7 +57,9 @@ master_json = { ], "name": "vanilla-260-default-master", "floating_ip_pool": "{floating_ip_pool}", - "flavor_id": "{flavor_id}" + "flavor_id": "{flavor_id}", + "auto_security_group": "{auto_security_group}", + 'security_groups': "{security_groups}" } worker_json = { @@ -69,7 +71,9 @@ worker_json = { ], "name": "vanilla-260-default-worker", "floating_ip_pool": "{floating_ip_pool}", - "flavor_id": "{flavor_id}" + "flavor_id": "{flavor_id}", + "auto_security_group": "{auto_security_group}", + 'security_groups': "{security_groups}" } @@ -241,7 +245,8 @@ class TemplateUpdateTestCase(base.ConductorManagerTestCase): files = self._write_files( tempdir, [cluster_json, master_json, worker_json, some_other_json]) - get_configs.return_value = {"flavor_id": 2} + get_configs.return_value = {"flavor_id": '2', 'security_groups': [], + 'auto_security_group': False} option_values = {"plugin_name": None, "plugin_version": None} template_api.set_conf(Config(option_values)) @@ -286,7 +291,12 @@ class TemplateUpdateTestCase(base.ConductorManagerTestCase): files = self._write_files( tempdir, [cluster_json, master_json, worker_json]) - get_configs.return_value = {"flavor_id": 2} + get_configs.return_value = { + "flavor_id": '2', + 'security_groups': [], + 'auto_security_group': False + } + option_values = {"plugin_name": None, "plugin_version": None} template_api.set_conf(Config(option_values)) @@ -312,7 +322,8 @@ class TemplateUpdateTestCase(base.ConductorManagerTestCase): files = self._write_files( tempdir, [cluster_json, master_json, worker_json]) - get_configs.return_value = {"flavor_id": 2} + get_configs.return_value = {"flavor_id": '2', 'security_groups': [], + 'auto_security_group': False} option_values = {"plugin_name": None, "plugin_version": None} template_api.set_conf(Config(option_values)) @@ -603,7 +614,7 @@ class TemplateUpdateTestCase(base.ConductorManagerTestCase): @mock.patch("sahara.db.templates.api.get_configs") @mock.patch("sahara.db.templates.api.add_config_section_for_template") - def test_do_update(self, add_config, get_configs): + def test_do_update_trash(self, add_config, get_configs): self.logger.clear_log() ctx = context.ctx() @@ -611,15 +622,19 @@ class TemplateUpdateTestCase(base.ConductorManagerTestCase): self._write_files(tempdir, [cluster_json, master_json, worker_json]) - get_configs.return_value = {"flavor_id": 2, - "neutron_management_network": uuid.uuid4()} + get_configs.return_value = { + "flavor_id": '2', + "neutron_management_network": str(uuid.uuid4()), + 'auto_security_group': True, + 'security_groups': [], + } + option_values = {"tenant_id": ctx.tenant_id, "directory": tempdir, "norecurse": None, "plugin_name": None, "plugin_version": None} template_api.set_conf(Config(option_values)) - template_api.do_update() ngs = self.api.node_group_template_get_all(ctx) @@ -644,8 +659,11 @@ class TemplateUpdateTestCase(base.ConductorManagerTestCase): self._write_files(tempdir, [cluster_json, master_json, worker_json]) - get_configs.return_value = {"flavor_id": 2, - "neutron_management_network": uuid.uuid4()} + get_configs.return_value = { + "flavor_id": '2', + "neutron_management_network": str(uuid.uuid4()) + } + option_values = {"tenant_id": ctx.tenant_id, "directory": tempdir, "norecurse": None, @@ -679,8 +697,10 @@ class TemplateUpdateTestCase(base.ConductorManagerTestCase): self._write_files(tempdir, [cluster_json, master_json, worker_json]) - get_configs.return_value = {"flavor_id": 2, - "neutron_management_network": uuid.uuid4()} + get_configs.return_value = { + "flavor_id": '2', + "neutron_management_network": str(uuid.uuid4()) + } option_values = {"tenant_id": ctx.tenant_id, "directory": tempdir, "norecurse": None, @@ -714,8 +734,11 @@ class TemplateUpdateTestCase(base.ConductorManagerTestCase): self._write_files(tempdir, [cluster_json, master_json, worker_json]) - get_configs.return_value = {"flavor_id": 2, - "neutron_management_network": uuid.uuid4()} + get_configs.return_value = { + "flavor_id": '2', + "neutron_management_network": str(uuid.uuid4()) + } + option_values = {"tenant_id": ctx.tenant_id, "directory": tempdir, "norecurse": None, @@ -755,8 +778,11 @@ class TemplateUpdateTestCase(base.ConductorManagerTestCase): self._write_files(tempdir, [cluster_json, master_json, worker_json]) - get_configs.return_value = {"flavor_id": 2, - "neutron_management_network": uuid.uuid4()} + get_configs.return_value = { + "flavor_id": '2', + "neutron_management_network": str(uuid.uuid4()) + } + option_values = {"tenant_id": ctx.tenant_id, "directory": tempdir, "norecurse": None,