diff options
author | Gabe <redhatrises@gmail.com> | 2014-07-31 07:26:00 -0600 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2014-08-25 12:32:29 +0200 |
commit | 9415aba87789512e34cb4ed62534cde7822ff70b (patch) | |
tree | 0025f651dba6d550985364e84b4b11a88fe505d9 | |
parent | a25fe00c62117cb11a1e75fbcc4960a0cfa72aab (diff) | |
download | freeipa-9415aba87789512e34cb4ed62534cde7822ff70b.tar.gz freeipa-9415aba87789512e34cb4ed62534cde7822ff70b.tar.xz freeipa-9415aba87789512e34cb4ed62534cde7822ff70b.zip |
ipa trust-add command should be interactive
- Make ipa trust-add command interactive for realm_admin and realm_passwd
- Fix 'Active directory' typo to 'Active Directory'
https://fedorahosted.org/freeipa/ticket/3034
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
-rw-r--r-- | ipalib/plugins/trust.py | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/ipalib/plugins/trust.py b/ipalib/plugins/trust.py index fe1a76719..736cb6f57 100644 --- a/ipalib/plugins/trust.py +++ b/ipalib/plugins/trust.py @@ -435,7 +435,7 @@ sides. ), Password('realm_passwd?', cli_name='password', - label=_("Active directory domain administrator's password"), + label=_("Active Directory domain administrator's password"), confirm=False, ), Str('realm_server?', @@ -511,6 +511,30 @@ sides. return result + def interactive_prompt_callback(self, kw): + """ + Also ensure that realm_admin is prompted for if --admin or + --trust-secret is not specified when 'ipa trust-add' is run on the + system. + + Also ensure that realm_passwd is prompted for if --password or + --trust-secret is not specified when 'ipa trust-add' is run on the + system. + """ + + trust_secret = kw.get('trust_secret') + realm_admin = kw.get('realm_admin') + realm_passwd = kw.get('realm_passwd') + + if trust_secret is None: + if realm_admin is None: + kw['realm_admin'] = self.prompt_param( + self.params['realm_admin']) + + if realm_passwd is None: + kw['realm_passwd'] = self.Backend.textui.prompt_password( + self.params['realm_passwd'].label, confirm=False) + def validate_options(self, *keys, **options): if not _bindings_installed: raise errors.NotFound( |