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

rbarry at redhat.com rbarry at redhat.com
Wed Apr 6 14:23:17 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>
---
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/65/55765/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/55765
To unsubscribe, visit https://gerrit.ovirt.org/settings

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



More information about the node-patches mailing list