More paths missed (durn), but now fixed.

This commit is contained in:
Joshua Harlow
2012-06-19 18:07:47 -07:00
parent 05b522b0e1
commit d53e557306
3 changed files with 6 additions and 3 deletions

View File

@@ -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)

View File

@@ -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:

View File

@@ -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":