diff options
author | Martin Kosek <mkosek@redhat.com> | 2011-02-04 14:03:30 +0100 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2011-02-16 10:39:16 -0500 |
commit | e5d57d237b4f146faf2e5c27d4e9eb3359dc15b3 (patch) | |
tree | c6998fdaf83372e80e107da4d5dfc7246b552ce9 /ipalib/plugins/hbacrule.py | |
parent | a9dc175bc547996646c213661ca42906ffef83ab (diff) | |
download | freeipa-e5d57d237b4f146faf2e5c27d4e9eb3359dc15b3.tar.gz freeipa-e5d57d237b4f146faf2e5c27d4e9eb3359dc15b3.tar.xz freeipa-e5d57d237b4f146faf2e5c27d4e9eb3359dc15b3.zip |
HBAC plugin inconsistent output
This patch adds a proper summary text to HBAC command which is
then printed out in CLI. Now, HBAC plugin output is consistent
with other plugins.
https://fedorahosted.org/freeipa/ticket/596
Diffstat (limited to 'ipalib/plugins/hbacrule.py')
-rw-r--r-- | ipalib/plugins/hbacrule.py | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/ipalib/plugins/hbacrule.py b/ipalib/plugins/hbacrule.py index b834a1410..cb4dbb4f3 100644 --- a/ipalib/plugins/hbacrule.py +++ b/ipalib/plugins/hbacrule.py @@ -211,6 +211,9 @@ class hbacrule_add(LDAPCreate): """ Create a new HBAC rule. """ + + msg_summary = _('Added HBAC rule "%(value)s"') + def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options): # HBAC rules are enabled by default entry_attrs['ipaenabledflag'] = 'TRUE' @@ -224,6 +227,8 @@ class hbacrule_del(LDAPDelete): Delete an HBAC rule. """ + msg_summary = _('Deleted HBAC rule "%(value)s"') + api.register(hbacrule_del) @@ -232,6 +237,8 @@ class hbacrule_mod(LDAPUpdate): Modify an HBAC rule. """ + msg_summary = _('Modified HBAC rule "%(value)s"') + def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options): try: (dn, entry_attrs) = ldap.get_entry(dn, attrs_list) @@ -256,6 +263,10 @@ class hbacrule_find(LDAPSearch): Search for HBAC rules. """ + msg_summary = ngettext( + '%(count)d HBAC rule matched', '%(count)d HBAC rules matched', 0 + ) + api.register(hbacrule_find) @@ -271,6 +282,10 @@ class hbacrule_enable(LDAPQuery): """ Enable an HBAC rule. """ + + msg_summary = _('Enabled HBAC rule "%(value)s"') + has_output = output.standard_value + def execute(self, cn): ldap = self.obj.backend @@ -284,11 +299,10 @@ class hbacrule_enable(LDAPQuery): except errors.NotFound: self.obj.handle_not_found(cn) - return dict(result=True) - - def output_for_cli(self, textui, result, cn): - textui.print_name(self.name) - textui.print_dashed('Enabled HBAC rule "%s".' % cn) + return dict( + result=True, + value=cn, + ) api.register(hbacrule_enable) @@ -297,6 +311,10 @@ class hbacrule_disable(LDAPQuery): """ Disable an HBAC rule. """ + + msg_summary = _('Disabled HBAC rule "%(value)s"') + has_output = output.standard_value + def execute(self, cn): ldap = self.obj.backend @@ -310,11 +328,10 @@ class hbacrule_disable(LDAPQuery): except errors.NotFound: self.obj.handle_not_found(cn) - return dict(result=True) - - def output_for_cli(self, textui, result, cn): - textui.print_name(self.name) - textui.print_dashed('Disabled HBAC rule "%s".' % cn) + return dict( + result=True, + value=cn, + ) api.register(hbacrule_disable) |