summaryrefslogtreecommitdiff
path: root/cloudinit/distros/gentoo.py
diff options
context:
space:
mode:
authorzdc <zdc@users.noreply.github.com>2020-12-25 18:57:19 +0200
committerGitHub <noreply@github.com>2020-12-25 18:57:19 +0200
commit27c317f83d8e393254b6766b34fdf8d29148ea8f (patch)
treeea824de28fa639ba6ba8b212efaf53b5df2e90d9 /cloudinit/distros/gentoo.py
parent66dc53b1b3f8786f3bbb25e914c1dc8161af0494 (diff)
parentc6bcb8df28daa234686a563549681082eb3283a1 (diff)
downloadvyos-cloud-init-27c317f83d8e393254b6766b34fdf8d29148ea8f.tar.gz
vyos-cloud-init-27c317f83d8e393254b6766b34fdf8d29148ea8f.zip
Merge pull request #28 from zdc/T2117-equuleus-20.4
T2117: Cloud-init updated to 20.4
Diffstat (limited to 'cloudinit/distros/gentoo.py')
-rw-r--r--cloudinit/distros/gentoo.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/cloudinit/distros/gentoo.py b/cloudinit/distros/gentoo.py
index 2bee1c89..e9b82602 100644
--- a/cloudinit/distros/gentoo.py
+++ b/cloudinit/distros/gentoo.py
@@ -160,10 +160,12 @@ class Distro(distros.Distro):
pass
if not conf:
conf = HostnameConf('')
- conf.set_hostname(your_hostname)
- gentoo_hostname_config = 'hostname="%s"' % conf
- gentoo_hostname_config = gentoo_hostname_config.replace('\n', '')
- util.write_file(out_fn, gentoo_hostname_config, 0o644)
+
+ # Many distro's format is the hostname by itself, and that is the
+ # way HostnameConf works but gentoo expects it to be in
+ # hostname="the-actual-hostname"
+ conf.set_hostname('hostname="%s"' % your_hostname)
+ util.write_file(out_fn, str(conf), 0o644)
def _read_system_hostname(self):
sys_hostname = self._read_hostname(self.hostname_conf_fn)