From 8df4d1df107b76cfa5fd60f7913291fd9c192190 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Mon, 6 Feb 2012 14:40:59 -0600 Subject: [PATCH] Blueprint cli-auth: common cli args Add OS_USERNAME, OS_PASSWORD, OS_TENANT_NAME and OS_TOKEN support to glance client binary. Fixes lp923936 Change-Id: I9339b169eadbe198e6ed183cf1aeb42b99f3a7d9 --- Authors | 1 + bin/glance | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Authors b/Authors index bd615641f9..3d5ef9c4ed 100644 --- a/Authors +++ b/Authors @@ -7,6 +7,7 @@ Chris Behrens Christopher MacGown Cory Wright Dan Prince +Dean Troyer Donal Lafferty Eldar Nugaev Eoghan Glynn diff --git a/bin/glance b/bin/glance index ea642d4c71..86b3387b12 100755 --- a/bin/glance +++ b/bin/glance @@ -731,9 +731,13 @@ def get_client(options): specified by the --host and --port options supplied to the CLI """ - creds = dict(username=options.username or os.getenv('OS_AUTH_USER'), - password=options.password or os.getenv('OS_AUTH_KEY'), - tenant=options.tenant or os.getenv('OS_AUTH_TENANT'), + creds = dict(username=options.username or \ + os.getenv('OS_AUTH_USER', os.getenv('OS_USERNAME')), + password=options.password or \ + os.getenv('OS_AUTH_KEY', os.getenv('OS_PASSWORD')), + tenant=options.tenant or \ + os.getenv('OS_AUTH_TENANT', + os.getenv('OS_TENANT_NAME')), auth_url=options.auth_url or os.getenv('OS_AUTH_URL'), strategy=options.auth_strategy or \ os.getenv('OS_AUTH_STRATEGY', 'noauth')) @@ -743,7 +747,9 @@ def get_client(options): creds['auth_url'].find('https') != -1)) return glance_client.Client(host=options.host, port=options.port, - use_ssl=use_ssl, auth_tok=options.auth_token, + use_ssl=use_ssl, + auth_tok=options.auth_token or \ + os.getenv('OS_TOKEN'), creds=creds)