[node-patches] Change in ovirt-node[master]: defaults: Hostname - remove alias manipulation

dougsland at redhat.com dougsland at redhat.com
Thu Aug 6 04:03:54 UTC 2015


Douglas Schilling Landgraf has uploaded a new change for review.

Change subject: defaults: Hostname - remove alias manipulation
......................................................................

defaults: Hostname - remove alias manipulation

Currently, when user execute autoinstall using hostname=foo
the ovirt-node will add an alias into 127.0.0.1 which affects
the command hostname -f. This behaviour also affects users
which sets hostname via TUI.

Example after using hostname=foo:

$ hostname
foo

$ hostname -f
localhost.localdomain

If any tool or service is based in the hostname -f command will
get affected. This patch removes the unneed alias.

Change-Id: I9c57c502355e7f5e95cb8f160f1ccd30c5175127
Signed-off-by: Douglas Schilling Landgraf <dougsland at redhat.com>
---
M src/ovirt/node/config/defaults.py
1 file changed, 0 insertions(+), 26 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/54/44454/1

diff --git a/src/ovirt/node/config/defaults.py b/src/ovirt/node/config/defaults.py
index a833695..5c731fd 100755
--- a/src/ovirt/node/config/defaults.py
+++ b/src/ovirt/node/config/defaults.py
@@ -711,34 +711,8 @@
                 self.hostname = hostname
 
             def commit(self):
-                aug = AugeasWrapper()
-
-                localhost_entry = None
-                for entry in aug.match("/files/etc/hosts/*"):
-                    if aug.get(entry + "/ipaddr") == "127.0.0.1":
-                        localhost_entry = entry
-                        break
-
-                if not localhost_entry:
-                    raise RuntimeError("Couldn't find entry for localhost")
-
-                # Remove all aliases
-                for alias_entry in aug.match(localhost_entry + "/alias"):
-                    aug.remove(alias_entry, False)
-
-                # ... and create a new one
-                aliases = ["localhost", "localhost.localdomain"]
-                if self.hostname:
-                    aliases.append(self.hostname)
-
-                for _idx, alias in enumerate(aliases):
-                    idx = _idx + 1
-                    p = "%s/alias[%s]" % (localhost_entry, idx)
-                    aug.set(p, alias, False)
-
                 config.network.hostname(self.hostname)
 
-                fs.Config().persist("/etc/hosts")
                 fs.Config().persist("/etc/hostname")
                 fs.Config().persist("/etc/sysconfig/network")
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9c57c502355e7f5e95cb8f160f1ccd30c5175127
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