From ca7ebd82ef4d111a4c6427a7962ca78e189c1612 Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Fri, 21 Mar 2025 14:51:05 +0100 Subject: [PATCH] Print instructions to set OSM_HOSTNAME in case of NotFound exception Change-Id: I42c6a82419355c44c20fd251638c215a8c340eb1 Signed-off-by: garciadeblas --- osmclient/scripts/osm.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/osmclient/scripts/osm.py b/osmclient/scripts/osm.py index 5d33183..2976e19 100755 --- a/osmclient/scripts/osm.py +++ b/osmclient/scripts/osm.py @@ -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: -- 2.25.1