[Freeipa-devel] [freeipa PR#394][comment] Add fix for ipa plugins command
martbab
freeipa-github-notification at redhat.com
Mon Jan 16 16:21:48 UTC 2017
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
Command
# echo '# echo 'TWV0aG9k' | base64 -d && echo
Method
```
One way to fix this is to wrap namespace name in `six.test_type`, this should work in both py2 and py3:
```diff
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(
result=result
```
"""
See the full comment at https://github.com/freeipa/freeipa/pull/394#issuecomment-272905328
More information about the Freeipa-devel
mailing list