URL: https://github.com/freeipa/freeipa/pull/1065
Author: stlaz
 Title: #1065: [Backport][ipa-4-6] pkinit: fix sorting dicts
Action: opened

PR body:
"""
This PR was opened automatically because PR #1029 was pushed to master and 
backport to ipa-4-6 is required.
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/1065/head:pr1065
git checkout pr1065
From 1707fb1e7c48c332cc00bd7bc10f764c6bc5eeff Mon Sep 17 00:00:00 2001
From: Stanislav Laznicka <slazn...@redhat.com>
Date: Thu, 31 Aug 2017 18:18:21 +0200
Subject: [PATCH] pkinit: fix sorting dictionaries

Python 3 discovered this issue since dictionaries themselves don't
implement comparisons.

https://pagure.io/freeipa/issue/7131
---
 ipaserver/plugins/pkinit.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ipaserver/plugins/pkinit.py b/ipaserver/plugins/pkinit.py
index 970f955c54..e364dfa06b 100644
--- a/ipaserver/plugins/pkinit.py
+++ b/ipaserver/plugins/pkinit.py
@@ -121,6 +121,7 @@ def execute(self, *keys, **options):
         if server is not None:
             self.api.Object.server_role.ensure_master_exists(server)
 
-        result = sorted(self.get_pkinit_status(server, status))
+        result = sorted(self.get_pkinit_status(server, status),
+                        key=lambda d: d.get('server_server'))
 
         return dict(result=result, count=len(result), truncated=False)
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to