service installers: clean up the inheritance

Instead of delegating handling of some parameters like fstore to the parent
class, the *Instance installers had the logic copy-pasted in their
constructors. Some other members were also moved to the Service class and the
parent class constructors in children were fixed to modern standards of
initializing parent class in Python.

https://fedorahosted.org/freeipa/ticket/6392

Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
This commit is contained in:
Martin Babinsky
2016-11-03 16:38:06 +01:00
committed by Jan Cholasta
parent 1e6366bc9f
commit 15f282cf2c
11 changed files with 51 additions and 72 deletions

View File

@@ -28,7 +28,6 @@ import dns.name
from ipaserver.install import service
from ipaserver.install import installutils
from ipapython import sysrestore
from ipapython import ipautil
from ipapython import kernel_keyring
from ipalib.constants import CACERT
@@ -50,7 +49,11 @@ class KpasswdInstance(service.SimpleServiceInstance):
class KrbInstance(service.Service):
def __init__(self, fstore=None):
service.Service.__init__(self, "krb5kdc", service_desc="Kerberos KDC")
super(KrbInstance, self).__init__(
"krb5kdc",
service_desc="Kerberos KDC",
fstore=fstore
)
self.fqdn = None
self.realm = None
self.domain = None
@@ -63,11 +66,6 @@ class KrbInstance(service.Service):
self.sub_dict = None
self.pkcs12_info = None
if fstore:
self.fstore = fstore
else:
self.fstore = sysrestore.FileStore(paths.SYSRESTORE)
suffix = ipautil.dn_attribute_property('_suffix')
subject_base = ipautil.dn_attribute_property('_subject_base')