From 21afc6c0d57fb98d612bd541f3c1a6a7857bd53e Mon Sep 17 00:00:00 2001 From: Shu Muto Date: Tue, 13 Sep 2016 11:18:03 +0900 Subject: [PATCH] Use "cluster" and "cluster_template" of magnumclient This patch changes "bay" and "baymodel" of magnumclient to "cluster" and "cluster_template", as last change for renaming bay to cluster. Change-Id: I77b6dc02738a1c455274bdb34bddcc91e21a30cb Implements: blueprint rename-bay-to-cluster --- magnum_ui/api/magnum.py | 26 +++++++++---------- .../clusters/create/cluster-model.js | 4 +-- .../create/info/cluster.info.controller.js | 6 ++--- .../clusters/create/info/info.html | 4 +-- .../clusters/create/misc/misc.html | 2 +- .../clusters/details/drawer.html | 2 +- .../clusters/details/overview.controller.js | 2 +- .../clusters/details/overview.html | 8 +++--- magnum_ui/test/api_tests/rest_api_tests.py | 9 ++++--- magnum_ui/test/test_data.py | 10 +++---- 10 files changed, 37 insertions(+), 36 deletions(-) diff --git a/magnum_ui/api/magnum.py b/magnum_ui/api/magnum.py index bb5fc2c7..8883c870 100644 --- a/magnum_ui/api/magnum.py +++ b/magnum_ui/api/magnum.py @@ -36,8 +36,8 @@ CLUSTER_TEMPLATE_CREATE_ATTRS = ['name', 'image_id', 'flavor_id', 'floating_ip_enabled', 'master_lb_enabled', 'insecure_registry'] -CLUSTER_CREATE_ATTRS = ['name', 'baymodel_id', 'node_count', - 'discovery_url', 'cluster_create_timeout', +CLUSTER_CREATE_ATTRS = ['name', 'cluster_template_id', 'node_count', + 'discovery_url', 'create_timeout', 'master_count'] CERTIFICATE_CREATE_ATTRS = ['cluster_uuid', 'csr'] @@ -83,21 +83,21 @@ def cluster_template_create(request, **kwargs): kv = v.split("=", 1) labels[kv[0]] = kv[1] args["labels"] = labels - return magnumclient(request).baymodels.create(**args) + return magnumclient(request).cluster_templates.create(**args) def cluster_template_delete(request, id): - return magnumclient(request).baymodels.delete(id) + return magnumclient(request).cluster_templates.delete(id) def cluster_template_list(request, limit=None, marker=None, sort_key=None, sort_dir=None, detail=True): - return magnumclient(request).baymodels.list(limit, marker, sort_key, - sort_dir, detail) + return magnumclient(request).cluster_templates.list( + limit, marker, sort_key, sort_dir, detail) def cluster_template_show(request, id): - return magnumclient(request).baymodels.get(id) + return magnumclient(request).cluster_templates.get(id) def cluster_create(request, **kwargs): @@ -108,25 +108,25 @@ def cluster_create(request, **kwargs): else: raise exceptions.BadRequest( "Key must be in %s" % ",".join(CLUSTER_CREATE_ATTRS)) - return magnumclient(request).bays.create(**args) + return magnumclient(request).clusters.create(**args) def cluster_update(request, id, patch): - return magnumclient(request).bays.update(id, patch) + return magnumclient(request).clusters.update(id, patch) def cluster_delete(request, id): - return magnumclient(request).bays.delete(id) + return magnumclient(request).clusters.delete(id) def cluster_list(request, limit=None, marker=None, sort_key=None, sort_dir=None, detail=True): - return magnumclient(request).bays.list(limit, marker, sort_key, - sort_dir, detail) + return magnumclient(request).clusters.list(limit, marker, sort_key, + sort_dir, detail) def cluster_show(request, id): - return magnumclient(request).bays.get(id) + return magnumclient(request).clusters.get(id) def certificate_create(request, **kwargs): diff --git a/magnum_ui/static/dashboard/container-infra/clusters/create/cluster-model.js b/magnum_ui/static/dashboard/container-infra/clusters/create/cluster-model.js index b52e6ba3..3ce3f082 100644 --- a/magnum_ui/static/dashboard/container-infra/clusters/create/cluster-model.js +++ b/magnum_ui/static/dashboard/container-infra/clusters/create/cluster-model.js @@ -37,11 +37,11 @@ function initNewClusterSpec() { model.newClusterSpec = { name: null, - baymodel_id: null, + cluster_template_id: null, master_count: null, node_count: null, discover_url: null, - bay_create_timeout: null + create_timeout: null }; } diff --git a/magnum_ui/static/dashboard/container-infra/clusters/create/info/cluster.info.controller.js b/magnum_ui/static/dashboard/container-infra/clusters/create/info/cluster.info.controller.js index bf5d49ce..d5c72c79 100644 --- a/magnum_ui/static/dashboard/container-infra/clusters/create/info/cluster.info.controller.js +++ b/magnum_ui/static/dashboard/container-infra/clusters/create/info/cluster.info.controller.js @@ -39,7 +39,7 @@ function createClusterInfoController($q, $scope, basePath, magnum) { var ctrl = this; ctrl.cluster_templates = [{id:"", name: gettext("Choose a Cluster Template")}]; - $scope.model.newClusterSpec.baymodel_id = ""; + $scope.model.newClusterSpec.cluster_template_id = ""; $scope.cluster_template_detail = { name: "", id: "", @@ -53,7 +53,7 @@ $scope.changeClusterTemplate = function(){ angular.forEach(ctrl.cluster_templates, function(model, idx){ - if($scope.model.newClusterSpec.baymodel_id === model.id){ + if($scope.model.newClusterSpec.cluster_template_id === model.id){ $scope.cluster_template_detail.name = model.name; $scope.cluster_template_detail.id = model.id; $scope.cluster_template_detail.coe = model.coe; @@ -75,7 +75,7 @@ function onGetClusterTemplates(response) { Array.prototype.push.apply(ctrl.cluster_templates, response.items); if($scope.selected instanceof Object){ - $scope.model.newClusterSpec.baymodel_id = $scope.selected.id; + $scope.model.newClusterSpec.cluster_template_id = $scope.selected.id; $scope.changeClusterTemplate(); } } diff --git a/magnum_ui/static/dashboard/container-infra/clusters/create/info/info.html b/magnum_ui/static/dashboard/container-infra/clusters/create/info/info.html index ed5b44ae..62921e0d 100644 --- a/magnum_ui/static/dashboard/container-infra/clusters/create/info/info.html +++ b/magnum_ui/static/dashboard/container-infra/clusters/create/info/info.html @@ -15,14 +15,14 @@ -
+
Cluster Template Detail
Name
diff --git a/magnum_ui/static/dashboard/container-infra/clusters/create/misc/misc.html b/magnum_ui/static/dashboard/container-infra/clusters/create/misc/misc.html index 0f88e8f8..bbe4cf5c 100644 --- a/magnum_ui/static/dashboard/container-infra/clusters/create/misc/misc.html +++ b/magnum_ui/static/dashboard/container-infra/clusters/create/misc/misc.html @@ -10,7 +10,7 @@
diff --git a/magnum_ui/static/dashboard/container-infra/clusters/details/drawer.html b/magnum_ui/static/dashboard/container-infra/clusters/details/drawer.html index 4d11c2ba..70001ae1 100644 --- a/magnum_ui/static/dashboard/container-infra/clusters/details/drawer.html +++ b/magnum_ui/static/dashboard/container-infra/clusters/details/drawer.html @@ -18,7 +18,7 @@
Cluster Template
-
{$ item.baymodel_id $}
+
{$ item.cluster_template_id $}
Node Addresses
diff --git a/magnum_ui/static/dashboard/container-infra/clusters/details/overview.controller.js b/magnum_ui/static/dashboard/container-infra/clusters/details/overview.controller.js index 59bbbaf5..b5ef9d0d 100644 --- a/magnum_ui/static/dashboard/container-infra/clusters/details/overview.controller.js +++ b/magnum_ui/static/dashboard/container-infra/clusters/details/overview.controller.js @@ -41,7 +41,7 @@ function onGetCluster(cluster) { ctrl.cluster = cluster.data; - magnum.getClusterTemplate(ctrl.cluster.baymodel_id).success(onGetClusterTemplate); + magnum.getClusterTemplate(ctrl.cluster.cluster_template_id).success(onGetClusterTemplate); } function onGetClusterTemplate(cluster_template) { diff --git a/magnum_ui/static/dashboard/container-infra/clusters/details/overview.html b/magnum_ui/static/dashboard/container-infra/clusters/details/overview.html index c46ec7ee..ad43eb48 100644 --- a/magnum_ui/static/dashboard/container-infra/clusters/details/overview.html +++ b/magnum_ui/static/dashboard/container-infra/clusters/details/overview.html @@ -48,12 +48,12 @@
{$ ctrl.cluster.discovery_url $}
Cluster Create Timeout
-
+
Infinite
- {$ ctrl.cluster.bay_create_timeout $} minute + translate-n="ctrl.cluster.create_timeout" + translate-plural="{$ ctrl.cluster.create_timeout $} minutes"> + {$ ctrl.cluster.create_timeout $} minute
diff --git a/magnum_ui/test/api_tests/rest_api_tests.py b/magnum_ui/test/api_tests/rest_api_tests.py index de3399cd..66bbc971 100644 --- a/magnum_ui/test/api_tests/rest_api_tests.py +++ b/magnum_ui/test/api_tests/rest_api_tests.py @@ -58,13 +58,14 @@ class MagnumRestTestCase(test.TestCase): def test_cluster_template_delete(self, client): test_cluster_template = TEST.cluster_templates.first() request = self.mock_rest_request( - body='{"baymodel_id":' + str(test_cluster_template['uuid']) + '}') + body='{"cluster_template_id":' + + str(test_cluster_template['uuid']) + '}') response = magnum.ClusterTemplates().delete(request) self.assertStatusCode(response, 204) client.cluster_template_delete.assert_called_once_with( request, - u'baymodel_id') + u'cluster_template_id') # Clusters @mock.patch.object(magnum, 'magnum') @@ -97,13 +98,13 @@ class MagnumRestTestCase(test.TestCase): def test_cluster_delete(self, client): test_cluster = TEST.clusters.first() request = self.mock_rest_request( - body='{"bay_id":' + str(test_cluster['uuid']) + '}') + body='{"cluster_id":' + str(test_cluster['uuid']) + '}') response = magnum.Clusters().delete(request) self.assertStatusCode(response, 204) client.cluster_delete.assert_called_once_with( request, - u'bay_id') + u'cluster_id') # Certificates @mock.patch.object(magnum, 'magnum') diff --git a/magnum_ui/test/test_data.py b/magnum_ui/test/test_data.py index 5159cbde..97d4fddf 100644 --- a/magnum_ui/test/test_data.py +++ b/magnum_ui/test/test_data.py @@ -51,11 +51,11 @@ def data(TEST): # Clusters cluster_dict_1 = {"uuid": 1, "name": "peopleknowme", - "baymodel": cluster_template_dict_1["uuid"], - "node-count": "", - "master-count": "", - "discovery-url": "", - "timeout": 0} + "cluster_template_id": cluster_template_dict_1["uuid"], + "node_count": "", + "master_count": "", + "discovery_url": "", + "create_timeout": 0} TEST.clusters.add(cluster_dict_1)