mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-10-24 14:17:41 -05:00
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>
This commit is contained in:
1 parent
60fa6ed444
commit
f28cd62285
2 files changed
+10
-37
No files matched your search
+9
-1
@@ -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):
|
||||
"""
|
||||
|
||||
@@ -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)')
|
||||
|
||||
Reference in new issue
Block a user