summaryrefslogtreecommitdiffstats
path: root/ipa-server/ipaserver/ntpinstance.py
diff options
context:
space:
mode:
Diffstat (limited to 'ipa-server/ipaserver/ntpinstance.py')
-rw-r--r--ipa-server/ipaserver/ntpinstance.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/ipa-server/ipaserver/ntpinstance.py b/ipa-server/ipaserver/ntpinstance.py
index b321ec07..c40b12b0 100644
--- a/ipa-server/ipaserver/ntpinstance.py
+++ b/ipa-server/ipaserver/ntpinstance.py
@@ -20,6 +20,7 @@
import shutil
import service
+import sysrestore
from ipa import ipautil
class NTPInstance(service.Service):
@@ -45,19 +46,27 @@ class NTPInstance(service.Service):
ntp_conf = ipautil.template_file(ipautil.SHARE_DIR + "ntp.conf.server.template", sub_dict)
- shutil.copy("/etc/ntp.conf", "/etc/ntp.conf.ipasave")
+ sysrestore.backup_file("/etc/ntp.conf")
fd = open("/etc/ntp.conf", "w")
fd.write(ntp_conf)
fd.close()
+ def __start(self):
+ self.backup_state("running", self.is_running())
+ self.start()
+
+ def __enable(self):
+ self.backup_state("enabled", self.is_enabled())
+ 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("configuring ntpd to start on boot", self.chkconfig_on)
+ self.step("starting ntpd", self.__start)
+ self.step("configuring ntpd to start on boot", self.__enable)
self.start_creation("Configuring ntpd")