diff --git a/vmware_nsxlib/v3/utils.py b/vmware_nsxlib/v3/utils.py index e5e2dec0..3c71755b 100644 --- a/vmware_nsxlib/v3/utils.py +++ b/vmware_nsxlib/v3/utils.py @@ -48,9 +48,13 @@ def update_v3_tags(current_tags, tags_update): current_scopes = set([tag['scope'] for tag in current_tags]) updated_scopes = set([tag['scope'] for tag in tags_update]) + # All tags scopes which are either completley new or arleady defined on the + # resource are left in place, unless the tag value is empty, in that case + # it is ignored. tags = [{'scope': tag['scope'], 'tag': tag['tag']} for tag in (current_tags + tags_update) - if tag['scope'] in (current_scopes ^ updated_scopes)] + if tag['tag'] and + tag['scope'] in (current_scopes ^ updated_scopes)] modified_scopes = current_scopes & updated_scopes for tag in tags_update: