diff options
-rw-r--r-- | ipapython/platform/base.py | 8 | ||||
-rw-r--r-- | ipapython/platform/fedora16.py | 6 | ||||
-rw-r--r-- | ipapython/platform/redhat.py | 13 |
3 files changed, 23 insertions, 4 deletions
diff --git a/ipapython/platform/base.py b/ipapython/platform/base.py index 99189a101..d177cc82c 100644 --- a/ipapython/platform/base.py +++ b/ipapython/platform/base.py @@ -21,8 +21,9 @@ 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 should make them available # through knownservices.<name> and take care of remapping internally, if needed -wellknownservices = ['certmonger', 'dirsrv', 'httpd', 'ipa', 'krb5kdc', 'messagebus', - 'nslcd', 'nscd', 'ntpd', 'portmap', 'rpcbind', 'kadmin'] +wellknownservices = ['certmonger', 'dirsrv', 'httpd', 'ipa', 'krb5kdc', + 'messagebus', 'nslcd', 'nscd', 'ntpd', 'portmap', + 'rpcbind', 'kadmin', 'sshd'] class AuthConfig(object): """ @@ -141,6 +142,9 @@ class PlatformService(object): def remove(self, instance_name=""): return + def get_config_dir(self, instance_name=""): + return + class KnownServices(MagicDict): """ KnownServices is an abstract class factory that should give out instances of well-known diff --git a/ipapython/platform/fedora16.py b/ipapython/platform/fedora16.py index 369a1778b..2d0ede99a 100644 --- a/ipapython/platform/fedora16.py +++ b/ipapython/platform/fedora16.py @@ -100,12 +100,18 @@ class Fedora16IPAService(Fedora16Service): super(Fedora16IPAService, self).enable(instance_name) self.restart(instance_name) +class Fedora16SSHService(Fedora16Service): + def get_config_dir(self, instance_name=""): + return '/etc/ssh' + # Redirect directory server service through special sub-class due to its special handling of instances def f16_service(name): if name == 'dirsrv': return Fedora16DirectoryService(name) if name == 'ipa': return Fedora16IPAService(name) + if name == 'sshd': + return Fedora16SSHService(name) return Fedora16Service(name) class Fedora16Services(base.KnownServices): diff --git a/ipapython/platform/redhat.py b/ipapython/platform/redhat.py index d99a91747..aee8bcc3d 100644 --- a/ipapython/platform/redhat.py +++ b/ipapython/platform/redhat.py @@ -82,6 +82,10 @@ class RedHatService(base.PlatformService): def remove(self, instance_name=""): ipautil.run(["/sbin/chkconfig", "--del", self.service_name]) +class RedHatSSHService(RedHatService): + def get_config_dir(self, instance_name=""): + return '/etc/ssh' + class RedHatAuthConfig(base.AuthConfig): """ AuthConfig class implements system-independent interface to configure @@ -109,16 +113,21 @@ class RedHatAuthConfig(base.AuthConfig): args = self.__build_args() ipautil.run(["/usr/sbin/authconfig"]+args) +def redhat_service(name): + if name == 'sshd': + return RedHatSSHService(name) + return RedHatService(name) + class RedHatServices(base.KnownServices): def __init__(self): services = dict() for s in base.wellknownservices: - services[s] = RedHatService(s) + services[s] = redhat_service(s) # Call base class constructor. This will lock services to read-only super(RedHatServices, self).__init__(services) authconfig = RedHatAuthConfig -service = RedHatService +service = redhat_service knownservices = RedHatServices() def restore_context(filepath): |