diff options
author | huangtianhua <huangtianhua@huawei.com> | 2017-01-19 16:36:59 +0800 |
---|---|---|
committer | huangtianhua <huangtianhua@huawei.com> | 2017-01-20 06:15:38 +0000 |
commit | b075ae76edcb5c5d99b3a6308c567faafcc46ecf (patch) | |
tree | 3417b91f781a2a26943afe34bbb8b71aca19c161 /heat/engine/resources/openstack/senlin | |
parent | 6a64578abd52e71b41c4b6f3478069c0eecc5d07 (diff) | |
download | heat-b075ae76edcb5c5d99b3a6308c567faafcc46ecf.tar.gz |
Fix handle_create() of senlin cluster resource
The change I272fbace441db76339bb6fb689e7f863cca49cad
merged, some nits to be fixed in this patch:
1. redundant 'action' definition in handle_create()
2. give the default value [] for 'policies' properties
3. no need to get cluster info when get attribute
'policies'.
Change-Id: Ibcca31b59b3486a65a16538b571d29a12b158060
Diffstat (limited to 'heat/engine/resources/openstack/senlin')
-rw-r--r-- | heat/engine/resources/openstack/senlin/cluster.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/heat/engine/resources/openstack/senlin/cluster.py b/heat/engine/resources/openstack/senlin/cluster.py index db5b74b82..c2076f760 100644 --- a/heat/engine/resources/openstack/senlin/cluster.py +++ b/heat/engine/resources/openstack/senlin/cluster.py @@ -125,6 +125,7 @@ class Cluster(resource.Resource): properties.Schema.LIST, _('A list of policies to attach to this cluster.'), update_allowed=True, + default=[], support_status=support.SupportStatus(version='8.0.0'), schema=properties.Schema( properties.Schema.MAP, @@ -208,15 +209,12 @@ class Cluster(resource.Resource): 'metadata': self.properties[self.METADATA], 'timeout': self.properties[self.TIMEOUT] } - action = { - 'func': 'create_cluster', - 'params': params, - 'action_id': None, - 'done': False, - } + cluster = self.client().create_cluster(**params) action_id = cluster.location.split('/')[-1] self.resource_id_set(cluster.id) + # for cluster creation, we just to check the action status + # the action is executed above action = { 'action_id': action_id, 'done': False, @@ -375,9 +373,10 @@ class Cluster(resource.Resource): def _resolve_attribute(self, name): if self.resource_id is None: return - cluster = self.client().get_cluster(self.resource_id) + if name == self.ATTR_POLICIES: return self.client().cluster_policies(self.resource_id) + cluster = self.client().get_cluster(self.resource_id) return getattr(cluster, name, None) def _show_resource(self): |