mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-23 23:50:03 -06:00
ipaplatform: Do not use MagicDict for KnownServices
https://fedorahosted.org/freeipa/ticket/3090 Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
This commit is contained in:
parent
b1fc875c3a
commit
e9c9e3f009
@ -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):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user