diff options
author | Martin Babinsky <mbabinsk@redhat.com> | 2016-06-12 17:02:09 +0200 |
---|---|---|
committer | Martin Basti <mbasti@redhat.com> | 2016-06-15 13:51:48 +0200 |
commit | 567f00a59c53aca760336aea95423368ac621032 (patch) | |
tree | cddb9e0b7c2ca9e87feb47a5c147bf8542151cab /ipaserver/install/ntpinstance.py | |
parent | 905db92e61c2e56f8cce723e9c9d28e7968eccc4 (diff) | |
download | freeipa-567f00a59c53aca760336aea95423368ac621032.tar.gz freeipa-567f00a59c53aca760336aea95423368ac621032.tar.xz freeipa-567f00a59c53aca760336aea95423368ac621032.zip |
Add NTP to the list of services stored in IPA masters LDAP subtree
IPA masters can be configured as NTP servers but the status of this service
can not be determined centrally from querying relevant LDAP subtree. This
patch makes IPA master and replica publish the newly configured NTP service in
their service container during installation.
If the master was configured as NTP server, the NTP service entry will be
created upon upgrade.
https://fedorahosted.org/freeipa/ticket/5815
https://fedorahosted.org/freeipa/ticket/5826
Reviewed-By: Petr Spacek <pspacek@redhat.com>
Reviewed-By: Martin Basti <mbasti@redhat.com>
Diffstat (limited to 'ipaserver/install/ntpinstance.py')
-rw-r--r-- | ipaserver/install/ntpinstance.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/ipaserver/install/ntpinstance.py b/ipaserver/install/ntpinstance.py index 8b0f0e539..2cac7baf1 100644 --- a/ipaserver/install/ntpinstance.py +++ b/ipaserver/install/ntpinstance.py @@ -19,6 +19,7 @@ # from ipaserver.install import service +from ipaserver.install import sysupgrade from ipapython import sysrestore from ipapython import ipautil from ipaplatform.constants import constants @@ -28,9 +29,28 @@ from ipapython.ipa_log_manager import root_logger NTPD_OPTS_VAR = constants.NTPD_OPTS_VAR NTPD_OPTS_QUOTE = constants.NTPD_OPTS_QUOTE +NTP_EXPOSED_IN_LDAP = 'exposed_in_ldap' + + +def ntp_ldap_enable(fqdn, base_dn, realm): + ntp = NTPInstance(realm=realm) + is_exposed_in_ldap = sysupgrade.get_upgrade_state( + 'ntp', NTP_EXPOSED_IN_LDAP) + + was_running = ntp.is_running() + + if ntp.is_configured() and not is_exposed_in_ldap: + ntp.ldap_enable('NTP', fqdn, None, base_dn) + sysupgrade.set_upgrade_state('ntp', NTP_EXPOSED_IN_LDAP, True) + + if was_running: + ntp.start() + + class NTPInstance(service.Service): - def __init__(self, fstore=None): + def __init__(self, realm=None, fstore=None): service.Service.__init__(self, "ntpd", service_desc="NTP daemon") + self.realm = realm if fstore: self.fstore = fstore |