From 78e9a1baa7cf3c6da5a1d8c84bb51efad5a09a62 Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Tue, 6 Nov 2018 05:02:45 +0100 Subject: [PATCH] OSM_HOSTNAME defaults to 127.0.0.1 instead of None Change-Id: I8b53c03daf1b244feedd00a3457ef75b907b2e70 Signed-off-by: garciadeblas --- osmclient/scripts/osm.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/osmclient/scripts/osm.py b/osmclient/scripts/osm.py index e2e60ae..d1cd349 100755 --- a/osmclient/scripts/osm.py +++ b/osmclient/scripts/osm.py @@ -25,6 +25,7 @@ from prettytable import PrettyTable import yaml import json import time +import pycurl def check_client_version(obj, what, version='sol005'): ''' @@ -45,7 +46,7 @@ def check_client_version(obj, what, version='sol005'): @click.group() @click.option('--hostname', - default=None, + default="127.0.0.1", envvar='OSM_HOSTNAME', help='hostname of server. ' + 'Also can set OSM_HOSTNAME in environment') @@ -1567,4 +1568,11 @@ def ns_action(ctx, if __name__ == '__main__': - cli() + try: + cli() + except pycurl.error as e: + print(e) + print('Maybe "--hostname" option or OSM_HOSTNAME' + + 'environment variable needs to be specified') + exit(1) + -- 2.25.1