Douglas Schilling Landgraf has uploaded a new change for review. Change subject: network: set hostname must unpersist/persist ......................................................................
network: set hostname must unpersist/persist Currently, users can change only once the hostname, after that the /etc/hostname is persisted and the next call doesn't have the unpersist and will make the hostname change fail. This patch adds the persist and unpersist calls directly to the function that changes the /etc/hostname. Change-Id: Iaf37e97d3450ac60bfc1e2ee302b6ab728006973 Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1270736 Signed-off-by: Douglas Schilling Landgraf <[email protected]> --- M src/ovirt/node/config/defaults.py M src/ovirt/node/config/network.py 2 files changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/92/48392/1 diff --git a/src/ovirt/node/config/defaults.py b/src/ovirt/node/config/defaults.py index 6e26faf..f879527 100755 --- a/src/ovirt/node/config/defaults.py +++ b/src/ovirt/node/config/defaults.py @@ -740,7 +740,6 @@ config.network.hostname(self.hostname) fs.Config().persist("/etc/hosts") - fs.Config().persist("/etc/hostname") fs.Config().persist("/etc/sysconfig/network") utils.network.reset_resolver() diff --git a/src/ovirt/node/config/network.py b/src/ovirt/node/config/network.py index a2e35a5..07f7842 100644 --- a/src/ovirt/node/config/network.py +++ b/src/ovirt/node/config/network.py @@ -226,6 +226,7 @@ """Get or set the current hostname """ if new_hostname: + fs.Config().unpersist("/etc/hostname") # hostnamectl set's runtime and config file utils.process.check_call(["hostnamectl", "set-hostname", new_hostname]) @@ -237,6 +238,7 @@ # Restarting systemd-hostnamed doesn't help either. hostname_file = fs.File("/etc/hostname") hostname_file.write(contents=new_hostname, mode="w+") + fs.Config().persist("/etc/hostname") return socket.gethostname() -- To view, visit https://gerrit.ovirt.org/48392 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iaf37e97d3450ac60bfc1e2ee302b6ab728006973 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
