summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ipaplatform/base/services.py25
1 files changed, 23 insertions, 2 deletions
diff --git a/ipaplatform/base/services.py b/ipaplatform/base/services.py
index 11fa27357..56e959e91 100644
--- a/ipaplatform/base/services.py
+++ b/ipaplatform/base/services.py
@@ -26,11 +26,11 @@ interacting with system services.
import os
import json
import time
+import collections
import ipalib
from ipapython import ipautil
from ipaplatform.paths import paths
-from ipalib.plugable import MagicDict
# Canonical names of services as IPA wants to see them. As we need to have
# *some* naming, set them as in Red Hat distributions. Actual implementation
@@ -57,7 +57,7 @@ wellknownports = {
SERVICE_POLL_INTERVAL = 0.1 # seconds
-class KnownServices(MagicDict):
+class KnownServices(collections.Mapping):
"""
KnownServices is an abstract class factory that should give out instances
of well-known platform services. Actual implementation must create these
@@ -65,6 +65,27 @@ class KnownServices(MagicDict):
and cache them.
"""
+ def __init__(self, d):
+ self.__d = d
+
+ def __getitem__(self, key):
+ return self.__d[key]
+
+ def __iter__(self):
+ return iter(self.__d)
+
+ def __len__(self):
+ return len(self.__d)
+
+ def __call__(self):
+ return self.__d.itervalues()
+
+ def __getattr__(self, name):
+ try:
+ return self.__d[name]
+ except KeyError:
+ raise AttributeError(name)
+
class PlatformService(object):
"""