summaryrefslogtreecommitdiffstats
path: root/ipaserver/install/ntpinstance.py
diff options
context:
space:
mode:
authorTomas Babej <tbabej@redhat.com>2014-05-29 14:47:17 +0200
committerPetr Viktorin <pviktori@redhat.com>2014-06-16 19:48:20 +0200
commit4d2ef43f287aa96df3d65b97977fc7a824b6b33c (patch)
tree4adba8f39e1f874c89a73993d6a6455b649b7bb9 /ipaserver/install/ntpinstance.py
parentc7edd7b68c98d105f02a5977a0ff7c2a3081f2c9 (diff)
downloadfreeipa-4d2ef43f287aa96df3d65b97977fc7a824b6b33c.tar.gz
freeipa-4d2ef43f287aa96df3d65b97977fc7a824b6b33c.tar.xz
freeipa-4d2ef43f287aa96df3d65b97977fc7a824b6b33c.zip
ipaplatform: Move all filesystem paths to ipaplatform.paths module
https://fedorahosted.org/freeipa/ticket/4052 Reviewed-By: Petr Viktorin <pviktori@redhat.com>
Diffstat (limited to 'ipaserver/install/ntpinstance.py')
-rw-r--r--ipaserver/install/ntpinstance.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/ipaserver/install/ntpinstance.py b/ipaserver/install/ntpinstance.py
index f2e8ffe36..c653525d3 100644
--- a/ipaserver/install/ntpinstance.py
+++ b/ipaserver/install/ntpinstance.py
@@ -21,6 +21,7 @@
import service
from ipapython import sysrestore
from ipapython import ipautil
+from ipaplatform.paths import paths
from ipapython.ipa_log_manager import *
class NTPInstance(service.Service):
@@ -30,20 +31,20 @@ class NTPInstance(service.Service):
if fstore:
self.fstore = fstore
else:
- self.fstore = sysrestore.FileStore('/var/lib/ipa/sysrestore')
+ self.fstore = sysrestore.FileStore(paths.SYSRESTORE)
def __write_config(self):
- self.fstore.backup_file("/etc/ntp.conf")
- self.fstore.backup_file("/etc/sysconfig/ntpd")
+ self.fstore.backup_file(paths.NTP_CONF)
+ self.fstore.backup_file(paths.SYSCONFIG_NTPD)
# We use the OS variable to point it towards either the rhel
# or fedora pools. Other distros should be added in the future
# or we can get our own pool.
os = ""
- if ipautil.file_exists("/etc/fedora-release"):
+ if ipautil.file_exists(paths.ETC_FEDORA_RELEASE):
os = "fedora"
- elif ipautil.file_exists("/etc/redhat-release"):
+ elif ipautil.file_exists(paths.ETC_REDHAT_RELEASE):
os = "rhel"
srv_vals = []
@@ -57,7 +58,7 @@ class NTPInstance(service.Service):
file_changed = False
fudge_present = False
ntpconf = []
- fd = open("/etc/ntp.conf", "r")
+ fd = open(paths.NTP_CONF, "r")
for line in fd:
opt = line.split()
if len(opt) < 1:
@@ -85,7 +86,7 @@ class NTPInstance(service.Service):
ntpconf.append(line)
if file_changed or len(srv_vals) != 0 or not fudge_present:
- fd = open("/etc/ntp.conf", "w")
+ fd = open(paths.NTP_CONF, "w")
for line in ntpconf:
fd.write(line)
fd.write("\n### Added by IPA Installer ###\n")
@@ -99,7 +100,7 @@ class NTPInstance(service.Service):
#read in memory, find OPTIONS, check/change it, then overwrite file
needopts = [ {'val':'-x', 'need':True},
{'val':'-g', 'need':True} ]
- fd = open("/etc/sysconfig/ntpd", "r")
+ fd = open(paths.SYSCONFIG_NTPD, "r")
lines = fd.readlines()
fd.close()
for line in lines:
@@ -118,7 +119,7 @@ class NTPInstance(service.Service):
done = False
if newopts:
- fd = open("/etc/sysconfig/ntpd", "w")
+ fd = open(paths.SYSCONFIG_NTPD, "w")
for line in lines:
if not done:
sline = line.strip()
@@ -167,7 +168,7 @@ class NTPInstance(service.Service):
self.stop()
try:
- self.fstore.restore_file("/etc/ntp.conf")
+ self.fstore.restore_file(paths.NTP_CONF)
except ValueError, error:
root_logger.debug(error)
pass