Merge "Limit cluster update properties"
This commit is contained in:
commit
df257446ee
|
@ -35,6 +35,7 @@ CLUSTER_TEMPLATE_CREATE_ATTRS = cluster_templates.CREATION_ATTRIBUTES
|
|||
CLUSTER_CREATE_ATTRS = clusters.CREATION_ATTRIBUTES
|
||||
CERTIFICATE_CREATE_ATTRS = certificates.CREATION_ATTRIBUTES
|
||||
QUOTA_CREATION_ATTRIBUTES = quotas.CREATION_ATTRIBUTES
|
||||
CLUSTER_UPDATE_ALLOWED_PROPERTIES = set(['/node_count'])
|
||||
|
||||
|
||||
def _cleanup_params(attrs, create, **params):
|
||||
|
@ -138,6 +139,11 @@ def cluster_template_update(request, id, **kwargs):
|
|||
old = magnumclient(request).cluster_templates.get(id).to_dict()
|
||||
old = _cleanup_params(CLUSTER_TEMPLATE_CREATE_ATTRS, False, **old)
|
||||
patch = _create_patches(old, new)
|
||||
# NOTE(flwang): Now Magnum only support updating the node count for
|
||||
# cluster upddate action. So let's simplify it by only passing the
|
||||
# /node_count dict which can avoid many potential bugs.
|
||||
patch = [d for d in patch if d['path']
|
||||
in CLUSTER_UPDATE_ALLOWED_PROPERTIES]
|
||||
return magnumclient(request).cluster_templates.update(id, patch)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue