Skip to content

Commit

Permalink
Do not use none in stats
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed Nov 15, 2024
1 parent ca389bf commit 7116df3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions IM/Stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Stats():
@staticmethod
def _get_data(str_data, init_date=None, end_date=None):
dic = json.loads(str_data)
resp = {'creation_date': None}
resp = {'creation_date': ''}
if 'creation_date' in dic and dic['creation_date']:
creation_date = datetime.datetime.fromtimestamp(float(dic['creation_date']))
resp['creation_date'] = str(creation_date)
Expand All @@ -44,7 +44,7 @@ def _get_data(str_data, init_date=None, end_date=None):
if end_date and creation_date > end_date:
return None

resp['tosca_name'] = None
resp['tosca_name'] = ''
if 'extra_info' in dic and dic['extra_info'] and "TOSCA" in dic['extra_info']:
try:
tosca = yaml.safe_load(dic['extra_info']['TOSCA'])
Expand All @@ -56,8 +56,8 @@ def _get_data(str_data, init_date=None, end_date=None):
resp['vm_count'] = 0
resp['cpu_count'] = 0
resp['memory_size'] = 0
resp['cloud_type'] = None
resp['cloud_host'] = None
resp['cloud_type'] = ''
resp['cloud_host'] = ''
resp['hybrid'] = False
resp['deleted'] = True if 'deleted' in dic and dic['deleted'] else False
for str_vm_data in dic['vm_list']:
Expand Down

0 comments on commit 7116df3

Please sign in to comment.