pgreco / rpms / ipa

Forked from forks/areguera/rpms/ipa 4 years ago
Clone

Blame SOURCES/0005-ipa-advise-correct-handling-of-plugin-namespace-iter.patch

403b09
From c4d5331ec5361a5f607eca7bb576d5d387bf3824 Mon Sep 17 00:00:00 2001
403b09
From: Martin Babinsky <mbabinsk@redhat.com>
403b09
Date: Mon, 11 Jul 2016 14:03:36 +0200
403b09
Subject: [PATCH] ipa-advise: correct handling of plugin namespace iteration
403b09
403b09
The API object namespace iterators now yield plugin classes themselves
403b09
instead of their names as strings. The method enumerating through available
403b09
plugins needs to be made aware of this change.
403b09
403b09
https://fedorahosted.org/freeipa/ticket/6044
403b09
403b09
Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
403b09
---
403b09
 ipaserver/advise/base.py | 8 ++++----
403b09
 1 file changed, 4 insertions(+), 4 deletions(-)
403b09
403b09
diff --git a/ipaserver/advise/base.py b/ipaserver/advise/base.py
403b09
index d083a3c506074f0adbb49e7a6d9935b8d338e941..a2dc9ccee93811da415c1e1eb0b57f47ac817a3f 100644
403b09
--- a/ipaserver/advise/base.py
403b09
+++ b/ipaserver/advise/base.py
403b09
@@ -167,12 +167,12 @@ class IpaAdvise(admintool.AdminTool):
403b09
     def print_config_list(self):
403b09
         self.print_header('List of available advices')
403b09
 
403b09
-        max_keyword_len = max((len(keyword) for keyword in advise_api.Advice))
403b09
+        max_keyword_len = max(
403b09
+            (len(advice.__name__) for advice in advise_api.Advice))
403b09
 
403b09
-        for keyword in advise_api.Advice:
403b09
-            advice = getattr(advise_api.Advice, keyword, '')
403b09
+        for advice in advise_api.Advice:
403b09
             description = getattr(advice, 'description', '')
403b09
-            keyword = keyword.replace('_', '-')
403b09
+            keyword = advice.__name__.replace('_', '-')
403b09
 
403b09
             # Compute the number of spaces needed for the table to be aligned
403b09
             offset = max_keyword_len - len(keyword)
403b09
-- 
403b09
2.4.3
403b09