diff options
| author | Jan Cholasta <jcholast@redhat.com> | 2016-04-27 09:37:49 +0200 |
|---|---|---|
| committer | Jan Cholasta <jcholast@redhat.com> | 2016-05-25 16:06:26 +0200 |
| commit | f28cd62285dd6336fa7919b700149b23567595da (patch) | |
| tree | d0625e932bcd7111714f7fd558a29a2c34928fd8 | |
| parent | 60fa6ed4442279c2c42a72ee34c51b401e6a18d0 (diff) | |
| download | freeipa-f28cd62285dd6336fa7919b700149b23567595da.tar.gz freeipa-f28cd62285dd6336fa7919b700149b23567595da.tar.xz freeipa-f28cd62285dd6336fa7919b700149b23567595da.zip | |
frontend: move the interactive_prompt callback type to Command
Move interactive_prompt callback type from baseldap.BaseLDAPCommand to
Command.
This will make it possible to move all interactive_prompt callbacks to
ipaclient.
https://fedorahosted.org/freeipa/ticket/4739
Reviewed-By: David Kupka <dkupka@redhat.com>
| -rw-r--r-- | ipalib/frontend.py | 10 | ||||
| -rw-r--r-- | ipalib/plugins/baseldap.py | 37 |
2 files changed, 10 insertions, 37 deletions
diff --git a/ipalib/frontend.py b/ipalib/frontend.py index 23d720e72..191520b9b 100644 --- a/ipalib/frontend.py +++ b/ipalib/frontend.py @@ -425,7 +425,7 @@ class Command(HasParam): msg_summary = None msg_truncated = _('Results are truncated, try a more specific search') - callback_types = () + callback_types = ('interactive_prompt',) def __call__(self, *args, **options): """ @@ -1140,6 +1140,14 @@ class Command(HasParam): else: callbacks.append(callback) + @classmethod + def register_interactive_prompt_callback(cls, callback, first=False): + """Shortcut for register_callback('interactive_prompt', ...)""" + cls.register_callback('interactive_prompt', callback, first) + + def interactive_prompt_callback(self, kw): + return + class LocalOrRemote(Command): """ diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py index 4d4e5ac41..72e7e0725 100644 --- a/ipalib/plugins/baseldap.py +++ b/ipalib/plugins/baseldap.py @@ -890,8 +890,7 @@ last, after all sets and adds."""), callback_types = Method.callback_types + ('pre', 'post', - 'exc', - 'interactive_prompt') + 'exc') def get_summary_default(self, output): if 'value' in output: @@ -1088,11 +1087,6 @@ last, after all sets and adds."""), """Shortcut for register_callback('exc', ...)""" cls.register_callback('exc', callback, first) - @classmethod - def register_interactive_prompt_callback(cls, callback, first=False): - """Shortcut for register_callback('interactive_prompt', ...)""" - cls.register_callback('interactive_prompt', callback, first) - def _exc_wrapper(self, keys, options, call_func): """Function wrapper that automatically calls exception callbacks""" def wrapped(*call_args, **call_kwargs): @@ -1256,9 +1250,6 @@ class LDAPCreate(BaseLDAPCommand, crud.Create): def exc_callback(self, keys, options, exc, call_func, *call_args, **call_kwargs): raise exc - def interactive_prompt_callback(self, kw): - return - class LDAPQuery(BaseLDAPCommand, crud.PKQuery): """ @@ -1363,9 +1354,6 @@ class LDAPRetrieve(LDAPQuery): def exc_callback(self, keys, options, exc, call_func, *call_args, **call_kwargs): raise exc - def interactive_prompt_callback(self, kw): - return - class LDAPUpdate(LDAPQuery, crud.Update): """ @@ -1513,9 +1501,6 @@ class LDAPUpdate(LDAPQuery, crud.Update): def exc_callback(self, keys, options, exc, call_func, *call_args, **call_kwargs): raise exc - def interactive_prompt_callback(self, kw): - return - class LDAPDelete(LDAPMultiQuery): """ @@ -1606,9 +1591,6 @@ class LDAPDelete(LDAPMultiQuery): def exc_callback(self, keys, options, exc, call_func, *call_args, **call_kwargs): raise exc - def interactive_prompt_callback(self, kw): - return - class LDAPModMember(LDAPQuery): """ @@ -1752,9 +1734,6 @@ class LDAPAddMember(LDAPModMember): def exc_callback(self, keys, options, exc, call_func, *call_args, **call_kwargs): raise exc - def interactive_prompt_callback(self, kw): - return - class LDAPRemoveMember(LDAPModMember): """ @@ -1856,9 +1835,6 @@ class LDAPRemoveMember(LDAPModMember): def exc_callback(self, keys, options, exc, call_func, *call_args, **call_kwargs): raise exc - def interactive_prompt_callback(self, kw): - return - def gen_pkey_only_option(cli_name): return Flag('pkey_only?', @@ -2084,9 +2060,6 @@ class LDAPSearch(BaseLDAPCommand, crud.Search): def exc_callback(self, args, options, exc, call_func, *call_args, **call_kwargs): raise exc - def interactive_prompt_callback(self, kw): - return - class LDAPModReverseMember(LDAPQuery): """ @@ -2208,8 +2181,6 @@ class LDAPAddReverseMember(LDAPModReverseMember): def exc_callback(self, keys, options, exc, call_func, *call_args, **call_kwargs): raise exc - def interactive_prompt_callback(self, kw): - return class LDAPRemoveReverseMember(LDAPModReverseMember): """ @@ -2309,9 +2280,6 @@ class LDAPRemoveReverseMember(LDAPModReverseMember): def exc_callback(self, keys, options, exc, call_func, *call_args, **call_kwargs): raise exc - def interactive_prompt_callback(self, kw): - return - class LDAPModAttribute(LDAPQuery): @@ -2391,9 +2359,6 @@ class LDAPModAttribute(LDAPQuery): **call_kwargs): raise exc - def interactive_prompt_callback(self, kw): - return - class LDAPAddAttribute(LDAPModAttribute): msg_summary = _('added attribute value to entry %(value)') |
