- #get uuid
- if not af.check_valid_uuid(name):
- result, content = vim_action_get(mydb, tenant_id, datacenter, item, name)
- print content
- if result < 0:
- return result, content
- items = content.values()[0]
- if type(items)==list and len(items)==0:
- return -HTTP_Not_Found, "Not found " + item
- elif type(items)==list and len(items)>1:
- return -HTTP_Not_Found, "Found more than one %s with this name. Use uuid." % item
- else: # it is a dict
- item_id = items["id"]
- item_name = str(items.get("name"))
+ #get uuid name
+ result, content = vim_action_get(mydb, tenant_id, datacenter, item, name)
+ print content
+ if result < 0:
+ return result, content
+ items = content.values()[0]
+ if type(items)==list and len(items)==0:
+ return -HTTP_Not_Found, "Not found " + item
+ elif type(items)==list and len(items)>1:
+ return -HTTP_Not_Found, "Found more than one %s with this name. Use uuid." % item
+ else: # it is a dict
+ item_id = items["id"]
+ item_name = str(items.get("name"))