Blob Blame History Raw
From 361c708d5854786d8c80dd9864818137d733661c Mon Sep 17 00:00:00 2001
From: Christian Heimes <cheimes@redhat.com>
Date: Fri, 4 Mar 2016 23:54:04 +0100
Subject: [PATCH] Make PKIInstance and PKISubsystem hashable

The upgrade uses instance and subsystem as keys for dicts.

(cherry picked from commit 9e78f981e923c879033c26eebad0cb803d66b8d9)

Conflicts:
	tests/python/server/test_server.py
---
 base/server/python/pki/server/__init__.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/base/server/python/pki/server/__init__.py b/base/server/python/pki/server/__init__.py
index 971a3f6..0f61f2a 100644
--- a/base/server/python/pki/server/__init__.py
+++ b/base/server/python/pki/server/__init__.py
@@ -109,7 +109,8 @@ class PKISubsystem(object):
                 self.instance < other.instance or
                 self_type < other_type)
 
-    __hash__ = None
+    def __hash__(self):
+        return hash((self.name, self.instance, self.type))
 
     def load(self):
         self.config.clear()
@@ -391,7 +392,8 @@ class PKIInstance(object):
         return (self.name < other.name or
                 self.type < other.type)
 
-    __hash__ = None
+    def __hash__(self):
+        return hash((self.name, self.type))
 
     def is_valid(self):
         return os.path.exists(self.conf_dir)
-- 
1.8.3.1