NSXv3: Do not allow empty tag values on resources

Change-Id: I1a02672675565b239e1c1ae538f63d4fc12e2c65
This commit is contained in:
Roey Chen 2016-12-05 01:26:08 -08:00
parent b990e0a547
commit 85459a7f9b
1 changed files with 5 additions and 1 deletions

View File

@ -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: