summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-06-19 18:07:47 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-06-19 18:07:47 -0700
commit319412b9fac28ae0a0ae059f44e668bc7d3bf857 (patch)
tree645db52991056ed9630a872e6a93ce448bedab89 /cloudinit
parent43eb6d5aace53bef2116dde0796807befef1d8ff (diff)
downloadvyos-cloud-init-319412b9fac28ae0a0ae059f44e668bc7d3bf857.tar.gz
vyos-cloud-init-319412b9fac28ae0a0ae059f44e668bc7d3bf857.zip
More paths missed (durn), but now fixed.
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/distros/ubuntu.py2
-rw-r--r--cloudinit/transforms/ssh.py4
-rw-r--r--cloudinit/transforms/update_etc_hosts.py3
3 files changed, 6 insertions, 3 deletions
diff --git a/cloudinit/distros/ubuntu.py b/cloudinit/distros/ubuntu.py
index 94565b14..eeda2921 100644
--- a/cloudinit/distros/ubuntu.py
+++ b/cloudinit/distros/ubuntu.py
@@ -59,7 +59,7 @@ class Distro(distros.Distro):
lines.append("# Created by cloud-init")
lines.append(str(hostname))
contents = "\n".join(lines)
- util.write_file(out_fn, contents, 0644)
+ util.write_file(self._paths.join(False, out_fn), contents, 0644)
def update_hostname(self, hostname, prev_file):
hostname_prev = self._read_hostname(prev_file)
diff --git a/cloudinit/transforms/ssh.py b/cloudinit/transforms/ssh.py
index 33d4bb54..e5e99560 100644
--- a/cloudinit/transforms/ssh.py
+++ b/cloudinit/transforms/ssh.py
@@ -52,7 +52,8 @@ def handle(_name, cfg, cloud, log, _args):
# remove the static keys from the pristine image
if cfg.get("ssh_deletekeys", True):
- for f in glob.glob("/etc/ssh/ssh_host_*key*"):
+ key_pth = cloud.paths.join(False, "/etc/ssh/", "ssh_host_*key*")
+ for f in glob.glob(key_pth):
try:
util.del_file(f)
except:
@@ -88,6 +89,7 @@ def handle(_name, cfg, cloud, log, _args):
for keytype in genkeys:
keyfile = '/etc/ssh/ssh_host_%s_key' % (keytype)
keyfile = cloud.paths.join(False, keyfile)
+ util.ensure_dir(os.path.dirname(keyfile))
if not os.path.exists(keyfile):
cmd = ['ssh-keygen', '-t', keytype, '-N', '', '-f', keyfile]
try:
diff --git a/cloudinit/transforms/update_etc_hosts.py b/cloudinit/transforms/update_etc_hosts.py
index d0e56183..75615db1 100644
--- a/cloudinit/transforms/update_etc_hosts.py
+++ b/cloudinit/transforms/update_etc_hosts.py
@@ -42,7 +42,8 @@ def handle(name, cfg, cloud, log, _args):
raise Exception(("No hosts template could be"
" found for distro %s") % (distro_n))
- templater.render_to_file(tpl_fn_name, '/etc/hosts',
+ out_fn = cloud.paths.join(False, '/etc/hosts')
+ templater.render_to_file(tpl_fn_name, out_fn,
{'hostname': hostname, 'fqdn': fqdn})
elif manage_hosts == "localhost":