Merge "Add prompt parameter to Opt"
This commit is contained in:
commit
4cc3dd0b17
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -57,6 +57,8 @@ class Opt(object):
|
||||
:param str metavar: The <metavar> 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 = []
|
||||
|
10
releasenotes/notes/add-prompt-to-opt-d083acc357a7f07b.yaml
Normal file
10
releasenotes/notes/add-prompt-to-opt-d083acc357a7f07b.yaml
Normal file
@ -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.
|
Loading…
Reference in New Issue
Block a user