Fix update for labels

This patch fixes update for labels in cluster and cluster template.
Remove labels attributes from request for magnum API.

Change-Id: Id5b36020c7caea3d7858906464f3c108edb81668
This commit is contained in:
Shu Muto 2017-12-27 12:49:09 +09:00
parent 7b5db0a354
commit 99b1d6e9a2
1 changed files with 8 additions and 0 deletions

View File

@ -78,6 +78,10 @@ def _create_patches(old, new):
patch = []
for key in new:
if key == 'labels':
# NOTE(shu-mutou): labels for cluster template and cluster
# are not updatable.
continue
path = '/' + key
if key in old and old[key] != new[key]:
if new[key] is None or new[key] is '':
@ -89,6 +93,10 @@ def _create_patches(old, new):
patch.append({'op': 'add', 'path': path, 'value': new[key]})
for key in old:
if key == 'labels':
# NOTE(shu-mutou): labels for cluster template and cluster
# are not updatable.
continue
path = '/' + key
if key not in new:
patch.append({'op': 'remove', 'path': path})