mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
ipaplatform: Add NTPD_OPTS_VAR and NTPD_OPTS_QUOTE to constants
https://fedorahosted.org/freeipa/ticket/5343 Reviewed-By: Tomas Babej <tbabej@redhat.com>
This commit is contained in:
parent
24ebdf90a5
commit
43654c973c
@ -11,5 +11,9 @@ class BaseConstantsNamespace(object):
|
||||
HTTPD_USER = "apache"
|
||||
IPA_DNS_PACKAGE_NAME = "freeipa-server-dns"
|
||||
NAMED_USER = "named"
|
||||
# ntpd init variable used for daemon options
|
||||
NTPD_OPTS_VAR = "OPTIONS"
|
||||
# quote used for daemon options
|
||||
NTPD_OPTS_QUOTE = "\""
|
||||
# nfsd init variable used to enable kerberized NFS
|
||||
SECURE_NFS_VAR = "SECURE_NFS"
|
||||
|
@ -21,9 +21,13 @@
|
||||
from ipaserver.install import service
|
||||
from ipapython import sysrestore
|
||||
from ipapython import ipautil
|
||||
from ipaplatform.constants import constants
|
||||
from ipaplatform.paths import paths
|
||||
from ipapython.ipa_log_manager import *
|
||||
|
||||
NTPD_OPTS_VAR = constants.NTPD_OPTS_VAR
|
||||
NTPD_OPTS_QUOTE = constants.NTPD_OPTS_QUOTE
|
||||
|
||||
class NTPInstance(service.Service):
|
||||
def __init__(self, fstore=None):
|
||||
service.Service.__init__(self, "ntpd", service_desc="NTP daemon")
|
||||
@ -106,9 +110,9 @@ class NTPInstance(service.Service):
|
||||
fd.close()
|
||||
for line in lines:
|
||||
sline = line.strip()
|
||||
if not sline.startswith('OPTIONS'):
|
||||
if not sline.startswith(NTPD_OPTS_VAR):
|
||||
continue
|
||||
sline = sline.replace('"', '')
|
||||
sline = sline.replace(NTPD_OPTS_QUOTE, '')
|
||||
for opt in needopts:
|
||||
if sline.find(opt['val']) != -1:
|
||||
opt['need'] = False
|
||||
@ -124,12 +128,12 @@ class NTPInstance(service.Service):
|
||||
for line in lines:
|
||||
if not done:
|
||||
sline = line.strip()
|
||||
if not sline.startswith('OPTIONS'):
|
||||
if not sline.startswith(NTPD_OPTS_VAR):
|
||||
fd.write(line)
|
||||
continue
|
||||
sline = sline.replace('"', '')
|
||||
sline = sline.replace(NTPD_OPTS_QUOTE, '')
|
||||
(variable, opts) = sline.split('=', 1)
|
||||
fd.write('OPTIONS="%s %s"\n' % (opts, ' '.join(newopts)))
|
||||
fd.write(NTPD_OPTS_VAR + '="%s %s"\n' % (opts, ' '.join(newopts)))
|
||||
done = True
|
||||
else:
|
||||
fd.write(line)
|
||||
|
Loading…
Reference in New Issue
Block a user