if long:
table = PrettyTable(['vim name', 'uuid', 'project', 'operational state', 'error details'])
else:
- table = PrettyTable(['vim name', 'uuid'])
+ table = PrettyTable(['vim name', 'uuid', 'operational state'])
for vim in resp:
if long:
vim_details = ctx.obj.vim.get(vim['uuid'])
table.add_row([vim['name'], vim['uuid'], '{} ({})'.format(project_name, project_id),
vim_state, wrap_text(text=error_details, width=80)])
else:
- table.add_row([vim['name'], vim['uuid']])
+ table.add_row([vim['name'], vim['uuid'], vim['_admin'].get('operationalState', '-')])
table.align = 'l'
print(table)
_, resp = self._http.get2_cmd('{}{}'.format(self._apiBase,filter_string))
if not resp:
return list()
- vim_accounts = []
- for datacenter in json.loads(resp):
- vim_accounts.append({"name": datacenter['name'], "uuid": datacenter['_id']
- if '_id' in datacenter else None})
+ vim_accounts = json.loads(resp)
+ for datacenter in vim_accounts:
+ datacenter["uuid"] = datacenter.get('_id') # backward compatibility?
return vim_accounts
def get(self, name):