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

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/394/head:pr394
git checkout pr394
From ddbbc1986416d6aa8e9a95baaf97f7fce7b303ce Mon Sep 17 00:00:00 2001
From: Abhijeet Kasurde <akasu...@redhat.com>
Date: Thu, 12 Jan 2017 18:38:37 +0530
Subject: [PATCH] Add fix for ipa plugins command

Fix adds count of plugins loaded to return dict

Fixes https://fedorahosted.org/freeipa/ticket/6513

Signed-off-by: Abhijeet Kasurde <akasu...@redhat.com>
---
 ipalib/misc.py                    | 3 ++-
 ipatests/test_cmdline/test_cli.py | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/ipalib/misc.py b/ipalib/misc.py
index 687b018..a5f9b6d 100644
--- a/ipalib/misc.py
+++ b/ipalib/misc.py
@@ -124,8 +124,9 @@ def execute(self, **options):
             for plugin in self.api[namespace]():
                 cls = type(plugin)
                 key = '{}.{}'.format(cls.__module__, cls.__name__)
-                result.setdefault(key, []).append(namespace)
+                result.setdefault(key, []).append(namespace.decode('utf-8'))
 
         return dict(
             result=result,
+            count=len(result),
         )
diff --git a/ipatests/test_cmdline/test_cli.py b/ipatests/test_cmdline/test_cli.py
index 07bab23..4585126 100644
--- a/ipatests/test_cmdline/test_cli.py
+++ b/ipatests/test_cmdline/test_cli.py
@@ -51,6 +51,9 @@ def fake_stdin(self, string_in):
     def test_ping(self):
         self.check_command('ping', 'ping')
 
+    def test_plugins(self):
+        self.check_command('plugins', 'plugins')
+
     def test_user_show(self):
         self.check_command('user-show admin', 'user_show', uid=u'admin')
 
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to