[node-patches] Change in ovirt-node[ovirt-3.6]: Set the canonical name in /etc/hosts with augeas, not aliases

rbarry at redhat.com rbarry at redhat.com
Thu Apr 7 13:13:44 UTC 2016


Ryan Barry has uploaded a new change for review.

Change subject: Set the canonical name in /etc/hosts with augeas, not aliases
......................................................................

Set the canonical name in /etc/hosts with augeas, not aliases

As it turns out, augeas will happily leave a localhost.localdomain
canonical hostname, even if all aliases are removed.

Set the canonical field with the new hostname instead, and add
the localhost aliases after that

Change-Id: I654295af494243bf03f6ba428ad51fa643414f59
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1318992
Signed-off-by: Ryan Barry <rbarry at redhat.com>
(cherry picked from commit b1a9baaac2882906d8426c1d4e59431aa89efef0)
---
M src/ovirt/node/config/defaults.py
1 file changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/14/55814/1

diff --git a/src/ovirt/node/config/defaults.py b/src/ovirt/node/config/defaults.py
index 0777d6d..2205b41 100755
--- a/src/ovirt/node/config/defaults.py
+++ b/src/ovirt/node/config/defaults.py
@@ -728,9 +728,10 @@
                     aug.remove(alias_entry, False)
 
                 # ... and create a new one
-                aliases = ["localhost", "localhost.localdomain"]
                 if self.hostname:
-                    aliases.insert(0, self.hostname)
+                    aug.set("%s/canonical" % localhost_entry, self.hostname)
+
+                aliases = ["localhost", "localhost.localdomain"]
 
                 for _idx, alias in enumerate(aliases):
                     idx = _idx + 1


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I654295af494243bf03f6ba428ad51fa643414f59
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Ryan Barry <rbarry at redhat.com>



More information about the node-patches mailing list