Fix get_tag_limits to be more careful

Change-Id: If52cc779b1c793caa3f180114a7428b43486e2b5
This commit is contained in:
Adit Sarfaty
2019-06-10 14:32:16 +03:00
parent 70a155f0fc
commit a8d02eb786

View File

@@ -269,8 +269,10 @@ class NsxLibBase(object):
def get_tag_limits(self):
try:
result = self.client.url_get('spec/vmware/types/Tag')
scope_length = result['properties']['scope']['maxLength']
tag_length = result['properties']['tag']['maxLength']
scope_length = result['properties']['scope'].get(
'maxLength', utils.MAX_RESOURCE_TYPE_LEN)
tag_length = result['properties']['tag'].get(
'maxLength', utils.MAX_TAG_LEN)
except Exception as e:
LOG.error("Unable to read tag limits. Reason: %s", e)
scope_length = utils.MAX_RESOURCE_TYPE_LEN