Douglas Schilling Landgraf has uploaded a new change for review. Change subject: network: if /etc/hostname doesn't exist, create it ......................................................................
network: if /etc/hostname doesn't exist, create it During autoinstall we must make sure /etc/hostname file exists in the distro. This patch make sure: - The installation will create /etc/hostname if it doesn't exist via hostnamectl. - strip values during comparation of variables, othewise caracteres '\n' can be catch. Change-Id: Idebfed15f63111ddc9b36ec09619b0f685b8394b Signed-off-by: Douglas Schilling Landgraf <[email protected]> --- M src/ovirt/node/config/network.py 1 file changed, 7 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/54/43754/1 diff --git a/src/ovirt/node/config/network.py b/src/ovirt/node/config/network.py index b5cbc61..1a6840e 100644 --- a/src/ovirt/node/config/network.py +++ b/src/ovirt/node/config/network.py @@ -235,8 +235,14 @@ utils.process.check_call(["hostnamectl", "set-hostname", new_hostname]) + if not os.path.exists("/etc/hostname") and new_hostname is None: + new_hostname = "localhost.localdomain" + utils.process.check_call(["hostnamectl", "set-hostname", + new_hostname]) + return new_hostname + current_hostname = utils.fs.get_contents(hostnamefile) - if new_hostname and current_hostname != new_hostname: + if new_hostname and current_hostname.strip() != new_hostname.strip(): raise RuntimeError(("Runtime hostname '%s' doesn't match" + "configured one: %s") % (current_hostname, new_hostname)) -- To view, visit https://gerrit.ovirt.org/43754 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Idebfed15f63111ddc9b36ec09619b0f685b8394b Gerrit-PatchSet: 1 Gerrit-Project: ovirt-node Gerrit-Branch: master Gerrit-Owner: Douglas Schilling Landgraf <[email protected]> _______________________________________________ node-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/node-patches
