From 85a463190fee87f5e16217e7439f5733922163dd Mon Sep 17 00:00:00 2001 From: Jake Yip Date: Tue, 30 Oct 2018 17:03:04 +1100 Subject: [PATCH] Fix cluster update instead of cluster template update In Change I2f0126fbf2f7396dda504b988ee11659824fcde8, the function that should be patched is cluster_update() instead of cluster_template_update(). cluster_template_update() allows for more than /node_count to be patched. Change-Id: I9c7995cf2393edbcc6c2488338a1230213248e95 --- magnum_ui/api/magnum.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/magnum_ui/api/magnum.py b/magnum_ui/api/magnum.py index cb21c94b..97de6ba8 100644 --- a/magnum_ui/api/magnum.py +++ b/magnum_ui/api/magnum.py @@ -143,11 +143,6 @@ 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) @@ -177,6 +172,13 @@ def cluster_update(request, id, **kwargs): old = magnumclient(request).clusters.get(id).to_dict() old = _cleanup_params(CLUSTER_CREATE_ATTRS, False, **old) patch = _create_patches(old, new) + + # NOTE(flwang): Now Magnum only support updating the node count for + # cluster update 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).clusters.update(id, patch, rollback=rollback)