summaryrefslogtreecommitdiffstats
path: root/ipa-server/ipaserver/ntpinstance.py
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2008-02-20 11:03:46 -0500
committerSimo Sorce <ssorce@redhat.com>2008-02-20 11:03:46 -0500
commit0ae42b28de803bcf024eb9b2a3560b9a0702ce4b (patch)
tree1c05185ad88772444087dfb7885c377dd7acb573 /ipa-server/ipaserver/ntpinstance.py
parent46cb6e9bdd74d217ac510576a4114bacb7adfb12 (diff)
downloadfreeipa.git-0ae42b28de803bcf024eb9b2a3560b9a0702ce4b.tar.gz
freeipa.git-0ae42b28de803bcf024eb9b2a3560b9a0702ce4b.tar.xz
freeipa.git-0ae42b28de803bcf024eb9b2a3560b9a0702ce4b.zip
Start ntpd first unless we do not want it.
Make sure we do sync the clock leaping to the current correct time. This avoids problems with bad dates on certificates, etc..
Diffstat (limited to 'ipa-server/ipaserver/ntpinstance.py')
-rw-r--r--ipa-server/ipaserver/ntpinstance.py26
1 files changed, 18 insertions, 8 deletions
diff --git a/ipa-server/ipaserver/ntpinstance.py b/ipa-server/ipaserver/ntpinstance.py
index e2765171..53858810 100644
--- a/ipa-server/ipaserver/ntpinstance.py
+++ b/ipa-server/ipaserver/ntpinstance.py
@@ -35,25 +35,34 @@ class NTPInstance(service.Service):
# or we can get our own pool.
os = ""
if ipautil.file_exists("/etc/fedora-release"):
- os = "fedora."
+ os = "fedora"
elif ipautil.file_exists("/etc/redhat-release"):
- os = "rhel."
+ os = "rhel"
sub_dict = { }
- sub_dict["SERVERA"] = "0.%spool.ntp.org" % os
- sub_dict["SERVERB"] = "1.%spool.ntp.org" % os
- sub_dict["SERVERC"] = "2.%spool.ntp.org" % os
+ sub_dict["SERVERA"] = "0.%s.pool.ntp.org" % os
+ sub_dict["SERVERB"] = "1.%s.pool.ntp.org" % os
+ sub_dict["SERVERC"] = "2.%s.pool.ntp.org" % os
ntp_conf = ipautil.template_file(ipautil.SHARE_DIR + "ntp.conf.server.template", sub_dict)
+ ntp_sysconf = ipautil.template_file(ipautil.SHARE_DIR + "ntpd.sysconfig.template", {})
sysrestore.backup_file("/etc/ntp.conf")
+ sysrestore.backup_file("/etc/sysconfig/ntpd")
fd = open("/etc/ntp.conf", "w")
fd.write(ntp_conf)
fd.close()
- def __start(self):
+ fd = open("/etc/sysconfig/ntpd", "w")
+ fd.write(ntp_sysconf)
+ fd.close()
+
+ def __stop(self):
self.backup_state("running", self.is_running())
+ self.stop()
+
+ def __start(self):
self.start()
def __enable(self):
@@ -61,13 +70,14 @@ class NTPInstance(service.Service):
self.chkconfig_on()
def create_instance(self):
- self.step("writing configuration", self.__write_config)
# we might consider setting the date manually using ntpd -qg in case
# the current time is very far off.
- self.step("starting ntpd", self.__start)
+ self.step("stopping ntpd", self.__stop)
+ self.step("writing configuration", self.__write_config)
self.step("configuring ntpd to start on boot", self.__enable)
+ self.step("starting ntpd", self.__start)
self.start_creation("Configuring ntpd")