diff --git a/keystoneauth1/loading/_plugins/identity/generic.py b/keystoneauth1/loading/_plugins/identity/generic.py index e35acc1b..ab9b547e 100644 --- a/keystoneauth1/loading/_plugins/identity/generic.py +++ b/keystoneauth1/loading/_plugins/identity/generic.py @@ -46,6 +46,9 @@ class Password(loading.BaseGenericLoader): deprecated=[loading.Opt('user-name')]), loading.Opt('user-domain-id', help="User's domain id"), loading.Opt('user-domain-name', help="User's domain name"), - loading.Opt('password', secret=True, help="User's password"), + loading.Opt('password', + secret=True, + prompt='Password: ', + help="User's password"), ]) return options diff --git a/keystoneauth1/loading/_plugins/identity/v2.py b/keystoneauth1/loading/_plugins/identity/v2.py index 4b510f8f..aaacd153 100644 --- a/keystoneauth1/loading/_plugins/identity/v2.py +++ b/keystoneauth1/loading/_plugins/identity/v2.py @@ -44,7 +44,10 @@ class Password(loading.BaseV2Loader): deprecated=[loading.Opt('user-name')], help='Username to login with'), loading.Opt('user-id', help='User ID to login with'), - loading.Opt('password', secret=True, help='Password to use'), + loading.Opt('password', + secret=True, + prompt='Password: ', + help='Password to use'), ]) return options diff --git a/keystoneauth1/loading/_plugins/identity/v3.py b/keystoneauth1/loading/_plugins/identity/v3.py index 3faea15d..de508145 100644 --- a/keystoneauth1/loading/_plugins/identity/v3.py +++ b/keystoneauth1/loading/_plugins/identity/v3.py @@ -47,7 +47,10 @@ class Password(loading.BaseV3Loader): _add_common_identity_options(options) options.extend([ - loading.Opt('password', secret=True, help="User's password"), + loading.Opt('password', + secret=True, + prompt='Password: ', + help="User's password"), ]) return options diff --git a/keystoneauth1/loading/opts.py b/keystoneauth1/loading/opts.py index 2220040f..a88e669c 100644 --- a/keystoneauth1/loading/opts.py +++ b/keystoneauth1/loading/opts.py @@ -57,6 +57,8 @@ class Opt(object): :param str metavar: The that should be printed in CLI help text. :param bool required: If the option is required to load the plugin. If a required option is not present loading should fail. + :param str prompt: If the option can be requested via a prompt (where + appropriate) set the string that should be used to prompt with. """ @positional() @@ -69,7 +71,8 @@ class Opt(object): deprecated=None, default=None, metavar=None, - required=False): + required=False, + prompt=None): if not callable(type): raise TypeError('type must be callable') @@ -85,6 +88,7 @@ class Opt(object): self.deprecated = [] if deprecated is None else deprecated self.default = default self.metavar = metavar + self.prompt = prompt # These are for oslo.config compat self.deprecated_opts = self.deprecated self.deprecated_for_removal = [] diff --git a/releasenotes/notes/add-prompt-to-opt-d083acc357a7f07b.yaml b/releasenotes/notes/add-prompt-to-opt-d083acc357a7f07b.yaml new file mode 100644 index 00000000..72bc114d --- /dev/null +++ b/releasenotes/notes/add-prompt-to-opt-d083acc357a7f07b.yaml @@ -0,0 +1,10 @@ +--- +prelude: > + Add the prompt parameter to loader Opts +features: + - The prompt parameter was added to the Opts provided by auth plugins. The + presence of the prompt parameter on an Option will indicate to plugin + loaders that it is ok to prompt the user for input for this parameter if + none is provided initially. Actual implementation of this prompting + mechanism will be handled by the individual loaders such as + os-client-config.