summaryrefslogtreecommitdiff
path: root/keystoneclient/auth
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-05-20 20:08:05 +0000
committerGerrit Code Review <review@openstack.org>2015-05-20 20:08:05 +0000
commite74f284243afe41a1f9f6c86ca61e86326db25c4 (patch)
treefc2b7e9675b0f544eed154232b37790585aa30b9 /keystoneclient/auth
parent4d440709c4ffa7b8adb84bcf191d6d8c55cb39fd (diff)
parent17d51f771ea9b6210c00c946d16d94fedc3f9cc1 (diff)
downloadpython-keystoneclient-e74f284243afe41a1f9f6c86ca61e86326db25c4.tar.gz
Merge "Prompt for password on CLI if not provided"
Diffstat (limited to 'keystoneclient/auth')
-rw-r--r--keystoneclient/auth/identity/generic/password.py8
-rw-r--r--keystoneclient/auth/identity/v2.py8
-rw-r--r--keystoneclient/auth/identity/v3/password.py9
3 files changed, 25 insertions, 0 deletions
diff --git a/keystoneclient/auth/identity/generic/password.py b/keystoneclient/auth/identity/generic/password.py
index 6790fe2..f1c8aa6 100644
--- a/keystoneclient/auth/identity/generic/password.py
+++ b/keystoneclient/auth/identity/generic/password.py
@@ -82,3 +82,11 @@ class Password(base.BaseGenericPlugin):
options = super(Password, cls).get_options()
options.extend(get_options())
return options
+
+ @classmethod
+ def load_from_argparse_arguments(cls, namespace, **kwargs):
+ if not (kwargs.get('password') or namespace.os_password):
+ kwargs['password'] = utils.prompt_user_password()
+
+ return super(Password, cls).load_from_argparse_arguments(namespace,
+ **kwargs)
diff --git a/keystoneclient/auth/identity/v2.py b/keystoneclient/auth/identity/v2.py
index c25ddfd..3ea74b7 100644
--- a/keystoneclient/auth/identity/v2.py
+++ b/keystoneclient/auth/identity/v2.py
@@ -145,6 +145,14 @@ class Password(Auth):
return {'passwordCredentials': auth}
@classmethod
+ def load_from_argparse_arguments(cls, namespace, **kwargs):
+ if not (kwargs.get('password') or namespace.os_password):
+ kwargs['password'] = utils.prompt_user_password()
+
+ return super(Password, cls).load_from_argparse_arguments(namespace,
+ **kwargs)
+
+ @classmethod
def get_options(cls):
options = super(Password, cls).get_options()
diff --git a/keystoneclient/auth/identity/v3/password.py b/keystoneclient/auth/identity/v3/password.py
index 7e432fa..d9cfa4a 100644
--- a/keystoneclient/auth/identity/v3/password.py
+++ b/keystoneclient/auth/identity/v3/password.py
@@ -13,6 +13,7 @@
from oslo_config import cfg
from keystoneclient.auth.identity.v3 import base
+from keystoneclient import utils
__all__ = ['PasswordMethod', 'Password']
@@ -86,3 +87,11 @@ class Password(base.AuthConstructor):
])
return options
+
+ @classmethod
+ def load_from_argparse_arguments(cls, namespace, **kwargs):
+ if not (kwargs.get('password') or namespace.os_password):
+ kwargs['password'] = utils.prompt_user_password()
+
+ return super(Password, cls).load_from_argparse_arguments(namespace,
+ **kwargs)