Minor fix in error_details, only shown for BROKEN or DEGRADED or old client versions
[osm/osmclient.git] / osmclient / scripts / osm.py
index 8dbf2b6..a369c48 100755 (executable)
@@ -368,7 +368,8 @@ def ns_list(ctx, filter, long):
             else:
                 current_operation = "{} ({})".format(nsr['_admin'].get('current-operation','-'), nsr['_admin']['nslcmop'])
             error_details = "N/A"
-            if ns_state == "BROKEN" or ns_state == "DEGRADED" or nsr.get('errorDescription'):
+            if ns_state == "BROKEN" or ns_state == "DEGRADED" or \
+                ('currentOperation' not in nsr and nsr.get('errorDescription')):
                 error_details = "{}\nDetail: {}".format(nsr['errorDescription'], nsr['errorDetail'])
         else:
             nsopdata = ctx.obj.ns.get_opdata(ns['id'])
@@ -1002,7 +1003,7 @@ def nsd_show(ctx, name, literal):
     print(table)
 
 
-@cli_osm.command(name='nsd-show', short_help='shows the content of a NSD')
+@cli_osm.command(name='nsd-show', short_help='shows the details of a NS package')
 @click.option('--literal', is_flag=True,
               help='print literally, no pretty table')
 @click.argument('name')
@@ -1016,7 +1017,7 @@ def nsd_show1(ctx, name, literal):
     nsd_show(ctx, name, literal)
 
 
-@cli_osm.command(name='nspkg-show', short_help='shows the content of a NSD')
+@cli_osm.command(name='nspkg-show', short_help='shows the details of a NS package')
 @click.option('--literal', is_flag=True,
               help='print literally, no pretty table')
 @click.argument('name')
@@ -1072,7 +1073,7 @@ def pkg_repo_show(ctx, pkgtype, name, repo, version, filter, literal):
     table.align = 'l'
     print(table)
 
-@cli_osm.command(name='vnfd-show', short_help='shows the content of a VNFD')
+@cli_osm.command(name='vnfd-show', short_help='shows the details of a NF package')
 @click.option('--literal', is_flag=True,
               help='print literally, no pretty table')
 @click.argument('name')
@@ -1086,7 +1087,7 @@ def vnfd_show1(ctx, name, literal):
     vnfd_show(ctx, name, literal)
 
 
-@cli_osm.command(name='vnfpkg-show', short_help='shows the content of a VNFD')
+@cli_osm.command(name='vnfpkg-show', short_help='shows the details of a NF package')
 @click.option('--literal', is_flag=True,
               help='print literally, no pretty table')
 @click.argument('name')
@@ -1099,7 +1100,7 @@ def vnfd_show2(ctx, name, literal):
     logger.debug("")
     vnfd_show(ctx, name, literal)
 
-@cli_osm.command(name='vnfpkg-repo-show', short_help='shows the content of a VNFD')
+@cli_osm.command(name='vnfpkg-repo-show', short_help='shows the details of a NF package in an OSM repository')
 @click.option('--literal', is_flag=True,
               help='print literally, no pretty table')
 @click.option('--repo',
@@ -1121,7 +1122,7 @@ def vnfd_show3(ctx, name, repo, version, literal=None, filter=None):
     pkg_repo_show(ctx, pkgtype, name, repo, version, filter, literal)
 
 
-@cli_osm.command(name='nsd-repo-show', short_help='shows the content of a NSD')
+@cli_osm.command(name='nsd-repo-show', short_help='shows the details of a NS package in an OSM repository')
 @click.option('--literal', is_flag=True,
               help='print literally, no pretty table')
 @click.option('--repo',
@@ -1142,7 +1143,7 @@ def nsd_repo_show(ctx, name, repo, version, literal=None, filter=None):
     pkgtype = 'ns'
     pkg_repo_show(ctx, pkgtype, name, repo, version, filter, literal)
 
-@cli_osm.command(name='nspkg-repo-show', short_help='shows the content of a NSD')
+@cli_osm.command(name='nspkg-repo-show', short_help='shows the details of a NS package in an OSM repository')
 @click.option('--literal', is_flag=True,
               help='print literally, no pretty table')
 @click.option('--repo',
@@ -1163,7 +1164,7 @@ def nsd_repo_show2(ctx, name, repo, version, literal=None, filter=None):
     pkgtype = 'ns'
     pkg_repo_show(ctx, pkgtype, name, repo, version, filter, literal)
 
-@cli_osm.command(name='nfpkg-show', short_help='shows the content of a NF Descriptor')
+@cli_osm.command(name='nfpkg-show', short_help='shows the details of a NF package')
 @click.option('--literal', is_flag=True,
               help='print literally, no pretty table')
 @click.argument('name')
@@ -1177,7 +1178,7 @@ def nfpkg_show(ctx, name, literal):
     vnfd_show(ctx, name, literal)
 
 
-@cli_osm.command(name='nfpkg-repo-show', short_help='shows the content of a VNFD')
+@cli_osm.command(name='nfpkg-repo-show', short_help='shows the details of a NF package in an OSM repository')
 @click.option('--literal', is_flag=True,
               help='print literally, no pretty table')
 @click.option('--repo',