From 5e883940ad1ed8ddd75bfa8519efce9f7b35afe8 Mon Sep 17 00:00:00 2001 From: "Yuanbin.Chen" Date: Mon, 10 Apr 2017 18:13:12 +0800 Subject: [PATCH] Add is_profile_only to Cluster resource Additionally, this adds is_profile_only to the query parameters. It was previously listed as `profile_only` so they'll both live together until 1.0, after which we remove the `profile_only` one and keep the prefixed one. Closes-Bug:1681385 Change-Id: I97793af0b0007b4c71e71cfac172533501da8225 Signed-off-by: Yuanbin.Chen --- openstack/cluster/v1/cluster.py | 4 +++- openstack/tests/unit/cluster/v1/test_cluster.py | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/openstack/cluster/v1/cluster.py b/openstack/cluster/v1/cluster.py index 9e82c29b9..988c77d2c 100644 --- a/openstack/cluster/v1/cluster.py +++ b/openstack/cluster/v1/cluster.py @@ -30,7 +30,7 @@ class Cluster(resource.Resource): patch_update = True _query_mapping = resource.QueryParameters( - 'name', 'status', 'sort', 'global_project', 'profile_only') + 'name', 'status', 'sort', 'global_project') # Properties #: The name of the cluster. @@ -74,6 +74,8 @@ class Cluster(resource.Resource): node_ids = resource.Body('nodes') #: Name of the profile used by the cluster. profile_name = resource.Body('profile_name') + #: Specify whether the cluster update should only pertain to the profile. + is_profile_only = resource.Body('profile_only', type=bool) #: A dictionary with dependency information of the cluster dependents = resource.Body('dependents', type=dict) diff --git a/openstack/tests/unit/cluster/v1/test_cluster.py b/openstack/tests/unit/cluster/v1/test_cluster.py index 54225e342..9ffb2bc80 100644 --- a/openstack/tests/unit/cluster/v1/test_cluster.py +++ b/openstack/tests/unit/cluster/v1/test_cluster.py @@ -26,6 +26,7 @@ FAKE = { 'min_size': 0, 'name': FAKE_NAME, 'profile_id': 'myserver', + 'profile_only': True, 'metadata': {}, 'dependents': {}, 'timeout': None, @@ -99,6 +100,15 @@ class TestCluster(testtools.TestCase): self.assertEqual(FAKE['created_at'], sot.created_at) self.assertEqual(FAKE['updated_at'], sot.updated_at) self.assertEqual(FAKE['dependents'], sot.dependents) + self.assertTrue(sot.is_profile_only) + + self.assertDictEqual({"limit": "limit", + "marker": "marker", + "name": "name", + "status": "status", + "sort": "sort", + "global_project": "global_project"}, + sot._query_mapping._mapping) def test_scale_in(self): sot = cluster.Cluster(**FAKE)