Ensure we don't grab None data

This commit is contained in:
Joshua Boniface 2021-06-13 16:43:25 -04:00
parent ae79113f7c
commit 647bce2a22
1 changed files with 5 additions and 2 deletions

View File

@ -152,8 +152,11 @@ class MetadataAPIInstance(object):
cur.execute(query, args)
data_raw = cur.fetchone()
self.close_database(conn, cur)
data = data_raw.get('userdata', None)
return data
if data_raw is not None:
data = data_raw.get('userdata', None)
return data
else:
return None
# VM details function
def get_vm_details(self, source_address):