From 5802354c1a0af36373dac6dc0719d8f8c51d7fc3 Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Mon, 23 Apr 2018 14:03:54 +0200 Subject: [PATCH] osm.py: fix bug in ns_list for old NB API Change-Id: Ibb70825fc6f960afee462c068b6019389dedbad4 Signed-off-by: garciadeblas --- osmclient/scripts/osm.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/osmclient/scripts/osm.py b/osmclient/scripts/osm.py index e3b284b..9c3e154 100755 --- a/osmclient/scripts/osm.py +++ b/osmclient/scripts/osm.py @@ -104,7 +104,7 @@ def cli(ctx, hostname, so_port, so_project, ro_hostname, ro_port, sol005): def ns_list(ctx, filter): '''list all NS instances''' if filter: - check_client_version(ctx.obj, '--filter option') + check_client_version(ctx.obj, '--filter') resp = ctx.obj.ns.list(filter) else: resp = ctx.obj.ns.list() @@ -117,16 +117,20 @@ def ns_list(ctx, filter): fullclassname = ctx.obj.__module__ + "." + ctx.obj.__class__.__name__ if fullclassname == 'osmclient.sol005.client.Client': nsr = ns + nsr_name = nsr['name'] + nsr_id = nsr['_id'] else: nsopdata = ctx.obj.ns.get_opdata(ns['id']) nsr = nsopdata['nsr:nsr'] + nsr_name = nsr['name-ref'] + nsr_id = nsr['ns-instance-config-ref'] opstatus = nsr['operational-status'] if 'operational-status' in nsr else 'Not found' configstatus = nsr['config-status'] if 'config-status' in nsr else 'Not found' if configstatus == "config_not_needed": configstatus = "configured (no charms)" table.add_row( - [nsr['name'], - nsr['_id'], + [nsr_name, + nsr_id, opstatus, configstatus]) table.align = 'l' -- 2.17.1