The Identity, Policy and Audit system
CentOS Sources
2016-11-03 403b09ab980c02ef36095973349a13e0181c794a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
From c4d5331ec5361a5f607eca7bb576d5d387bf3824 Mon Sep 17 00:00:00 2001
From: Martin Babinsky <mbabinsk@redhat.com>
Date: Mon, 11 Jul 2016 14:03:36 +0200
Subject: [PATCH] ipa-advise: correct handling of plugin namespace iteration
 
The API object namespace iterators now yield plugin classes themselves
instead of their names as strings. The method enumerating through available
plugins needs to be made aware of this change.
 
https://fedorahosted.org/freeipa/ticket/6044
 
Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
---
 ipaserver/advise/base.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
 
diff --git a/ipaserver/advise/base.py b/ipaserver/advise/base.py
index d083a3c506074f0adbb49e7a6d9935b8d338e941..a2dc9ccee93811da415c1e1eb0b57f47ac817a3f 100644
--- a/ipaserver/advise/base.py
+++ b/ipaserver/advise/base.py
@@ -167,12 +167,12 @@ class IpaAdvise(admintool.AdminTool):
     def print_config_list(self):
         self.print_header('List of available advices')
 
-        max_keyword_len = max((len(keyword) for keyword in advise_api.Advice))
+        max_keyword_len = max(
+            (len(advice.__name__) for advice in advise_api.Advice))
 
-        for keyword in advise_api.Advice:
-            advice = getattr(advise_api.Advice, keyword, '')
+        for advice in advise_api.Advice:
             description = getattr(advice, 'description', '')
-            keyword = keyword.replace('_', '-')
+            keyword = advice.__name__.replace('_', '-')
 
             # Compute the number of spaces needed for the table to be aligned
             offset = max_keyword_len - len(keyword)
-- 
2.4.3