[node-patches] Change in ovirt-node[master]: install: improve ntp option

dougsland at redhat.com dougsland at redhat.com
Tue Jun 9 01:36:47 UTC 2015


Douglas Schilling Landgraf has uploaded a new change for review.

Change subject: install: improve ntp option
......................................................................

install: improve ntp option

Previous commit e1836aa80 requires an improvement
to keep the ntp service started when the karg option
ntp=off is not provided.

Change-Id: I8275196d686089352f254fdbfa6167b13a32c76d
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1061081
Signed-off-by: Douglas Schilling Landgraf <dougsland at redhat.com>
---
M scripts/ovirt-init-functions.sh.in
M src/ovirt/node/config/defaults.py
2 files changed, 11 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/64/42064/1

diff --git a/scripts/ovirt-init-functions.sh.in b/scripts/ovirt-init-functions.sh.in
index 5b4d0c4..29ccf4d 100644
--- a/scripts/ovirt-init-functions.sh.in
+++ b/scripts/ovirt-init-functions.sh.in
@@ -1399,6 +1399,12 @@
         # Migrate config files if needed
         migrate_node_config
 
+        # Manual install doesn't persist /etc/ntp.conf and
+        # to start the ntp daemon is required to file be persisted.
+        if ! grep -q OVIRT_NTP /etc/default/ovirt; then
+            persist /etc/ntp.conf
+        fi
+
         # Re-load keyboard settings
         load_keyboard_config
 
diff --git a/src/ovirt/node/config/defaults.py b/src/ovirt/node/config/defaults.py
index 4190619..60edd94 100755
--- a/src/ovirt/node/config/defaults.py
+++ b/src/ovirt/node/config/defaults.py
@@ -913,29 +913,22 @@
     def transaction(self):
         m = Timeservers().retrieve()
 
+        disable = False
         servers = m["servers"]
-        disable = len(servers) == 1 and "off" in servers
+
+        if servers is not None and "off" in servers:
+            disable = True
 
         class WriteConfiguration(utils.Transaction.Element):
             title = "Writing timeserver configuration"
 
             def commit(self):
-                aug = AugeasWrapper()
-
-                p = "/files/etc/ntp.conf"
-                aug.remove(p, False)
-                aug.set(p + "/driftfile", "/var/lib/ntp/drift", False)
-                aug.set(p + "/includefile", "/etc/ntp/crypto/pw", False)
-                aug.set(p + "/keys", "/etc/ntp/keys", False)
-                aug.save()
+                config.network.timeservers(servers)
 
                 if disable:
-                    servers = []
                     utils.fs.Config().unpersist("/etc/ntp.conf")
                 else:
                     utils.fs.Config().persist("/etc/ntp.conf")
-
-                config.network.timeservers(servers)
 
         class ApplyConfiguration(utils.Transaction.Element):
             title = "Restarting time services"


-- 
To view, visit https://gerrit.ovirt.org/42064
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8275196d686089352f254fdbfa6167b13a32c76d
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <dougsland at redhat.com>



More information about the node-patches mailing list