ehlo,

attached patch fixes ticket #2699

On other places we do not require to return list by dict.keys().
There were patterns:
    something in a_dictionary.keys()
    ", ".join(a_dictionary.keys()))

LS
>From 952680d95bbc399d965cb09853e326f7f8e99554 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lsleb...@redhat.com>
Date: Tue, 4 Aug 2015 15:03:44 +0200
Subject: [PATCH] SSSDConfig: Return correct types in python3

In Python 3, dict.keys() returns a view rather than a list. Since dict keys
aren't in any particular order, indexing them doesn't make sense.

Resolves:
https://fedorahosted.org/sssd/ticket/2699
---
 src/config/SSSDConfig/__init__.py.in | 4 ++--
 src/config/SSSDConfigTest.py         | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/config/SSSDConfig/__init__.py.in 
b/src/config/SSSDConfig/__init__.py.in
index 
7d361026c09ce8fd8d6a69f6bb3f3817bc3d68ba..ac244d8bf71a683e217afc3f93f40446bc241f86
 100644
--- a/src/config/SSSDConfig/__init__.py.in
+++ b/src/config/SSSDConfig/__init__.py.in
@@ -1498,7 +1498,7 @@ class SSSDConfig(SSSDChangeConf):
                 if srv not in configured_services:
                     del service_dict[srv]
 
-            active_services = service_dict.keys()
+            active_services = list(service_dict.keys())
         else:
             active_services = []
 
@@ -1781,7 +1781,7 @@ class SSSDConfig(SSSDChangeConf):
                 if dom not in configured_domains:
                     del domain_dict[dom]
 
-            active_domains = domain_dict.keys()
+            active_domains = list(domain_dict.keys())
         else:
             active_domains = []
 
diff --git a/src/config/SSSDConfigTest.py b/src/config/SSSDConfigTest.py
index 
1d6107ceac1bde7acbfd2682cc144a4ef0881311..67289e012b863501cfae7761794633193e6a51c0
 100755
--- a/src/config/SSSDConfigTest.py
+++ b/src/config/SSSDConfigTest.py
@@ -1299,6 +1299,7 @@ class SSSDConfigTestSSSDConfig(unittest.TestCase):
             'nss',
             'pam']
         active_services = sssdconfig.list_active_services()
+        self.assertTrue(isinstance(active_services, list))
 
         for service in control_list:
             self.assertTrue(service in active_services,
@@ -1521,6 +1522,7 @@ class SSSDConfigTestSSSDConfig(unittest.TestCase):
             'IPA',
             'LOCAL']
         active_domains = sssdconfig.list_active_domains()
+        self.assertTrue(isinstance(active_domains, list))
 
         for domain in control_list:
             self.assertTrue(domain in active_domains,
-- 
2.5.0

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to