Print instructions to set OSM_HOSTNAME in case of NotFound exception 70/15070/1
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Fri, 21 Mar 2025 13:51:05 +0000 (14:51 +0100)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Fri, 21 Mar 2025 13:51:05 +0000 (14:51 +0100)
Change-Id: I42c6a82419355c44c20fd251638c215a8c340eb1
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
osmclient/scripts/osm.py

index 5d33183..2976e19 100755 (executable)
@@ -15,7 +15,7 @@
 
 import click
 from osmclient import client
-from osmclient.common.exceptions import ClientException
+from osmclient.common.exceptions import ClientException, NotFound
 from osmclient.cli_commands import (
     alarms,
     app_profile,
@@ -367,11 +367,13 @@ def cli():
         print(
             'Maybe "--hostname" option or OSM_HOSTNAME environment variable needs to be specified'
         )
-    except ClientException as exc:
-        print("ERROR: {}".format(exc))
+    except NotFound as exc:
+        print("NOT FOUND: {}".format(exc))
         print(
             'Maybe "--hostname" option or OSM_HOSTNAME environment variable needs to be specified'
         )
+    except ClientException as exc:
+        print("ERROR: {}".format(exc))
     except (FileNotFoundError, PermissionError) as exc:
         print("Cannot open file: {}".format(exc))
     except yaml.YAMLError as exc: