More paths missed (durn), but now fixed.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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":
|
||||
|
||||
Reference in New Issue
Block a user