URL: https://github.com/freeipa/freeipa/pull/394
Title: #394: Add fix for ipa plugins command

martbab commented:
Thanks the patch makes the command work. However, the namespace names are 
returned as string, not unicode literals and thus the framework returns them as 
base64-encoded values:

# ipa plugins       
  ipaclient.plugins.automember.automember_add_condition: Q29tbWFuZA==, TWV0aG9k
  ipaclient.plugins.automount.automountlocation_import: Q29tbWFuZA==
  ipaclient.plugins.automount.automountlocation_tofiles: Q29tbWFuZA==, TWV0aG9k
  <snip />
# echo 'Q29tbWFuZA==' | base64 -d && echo
# echo '# echo 'TWV0aG9k' | base64 -d && echo    

One way to fix this is to wrap namespace name in `six.test_type`, this should 
work in both py2 and py3:

diff --git a/ipalib/misc.py b/ipalib/misc.py
index 264ec29..6234961 100644
--- a/ipalib/misc.py
+++ b/ipalib/misc.py
@@ -3,6 +3,9 @@
 import re
+import six
 from ipalib import LocalOrRemote, _, ngettext
 from ipalib.output import Output, summary
 from ipalib import Flag
@@ -124,7 +127,7 @@ class plugins(LocalOrRemote):
             for plugin in self.api[namespace]():
                 cls = type(plugin)
                 key = '{}.{}'.format(cls.__module__, cls.__name__)
-                result.setdefault(key, []).append(namespace)
+                result.setdefault(key, []).append(six.text_type(namespace))
         return dict(


See the full comment at 
Manage your subscription for the Freeipa-devel mailing list:
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to