summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2014-10-17 16:18:18 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2014-10-17 16:18:18 -0700
commit211b09302ff3aff05b6c3c1382d8e7dd65e58b3a (patch)
treeaaa3e04b9eb4e673cafd51a8bd39f3e0bfc8c15b
parent2b054e2cb21a14a4db5f3b891854cc15bdfef709 (diff)
downloadvyos-cloud-init-211b09302ff3aff05b6c3c1382d8e7dd65e58b3a.tar.gz
vyos-cloud-init-211b09302ff3aff05b6c3c1382d8e7dd65e58b3a.zip
Allow the usr/lib/exec to vary and still work with write_keys
-rw-r--r--cloudinit/config/cc_keys_to_console.py11
-rw-r--r--cloudinit/distros/__init__.py1
-rw-r--r--cloudinit/distros/rhel.py1
3 files changed, 8 insertions, 5 deletions
diff --git a/cloudinit/config/cc_keys_to_console.py b/cloudinit/config/cc_keys_to_console.py
index ed7af690..58104f4d 100644
--- a/cloudinit/config/cc_keys_to_console.py
+++ b/cloudinit/config/cc_keys_to_console.py
@@ -26,13 +26,14 @@ from cloudinit import util
frequency = PER_INSTANCE
# This is a tool that cloud init provides
-HELPER_TOOL = '/usr/lib/cloud-init/write-ssh-key-fingerprints'
+HELPER_TOOL_TPL = '%s/cloud-init/write-ssh-key-fingerprints'
-def handle(name, cfg, _cloud, log, _args):
- if not os.path.exists(HELPER_TOOL):
+def handle(name, cfg, cloud, log, _args):
+ helper_path = HELPER_TOOL_TPL % (cloud.distro.usr_lib_exec)
+ if not os.path.exists(helper_path):
log.warn(("Unable to activate module %s,"
- " helper tool not found at %s"), name, HELPER_TOOL)
+ " helper tool not found at %s"), name, helper_path)
return
fp_blacklist = util.get_cfg_option_list(cfg,
@@ -42,7 +43,7 @@ def handle(name, cfg, _cloud, log, _args):
["ssh-dss"])
try:
- cmd = [HELPER_TOOL]
+ cmd = [helper_path]
cmd.append(','.join(fp_blacklist))
cmd.append(','.join(key_blacklist))
(stdout, _stderr) = util.subp(cmd)
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py
index 2599d9f2..49014477 100644
--- a/cloudinit/distros/__init__.py
+++ b/cloudinit/distros/__init__.py
@@ -51,6 +51,7 @@ LOG = logging.getLogger(__name__)
class Distro(object):
__metaclass__ = abc.ABCMeta
+ usr_lib_exec = "/usr/lib"
hosts_fn = "/etc/hosts"
ci_sudoers_fn = "/etc/sudoers.d/90-cloud-init-users"
hostname_conf_fn = "/etc/hostname"
diff --git a/cloudinit/distros/rhel.py b/cloudinit/distros/rhel.py
index e8abf111..d01124e3 100644
--- a/cloudinit/distros/rhel.py
+++ b/cloudinit/distros/rhel.py
@@ -50,6 +50,7 @@ class Distro(distros.Distro):
network_script_tpl = '/etc/sysconfig/network-scripts/ifcfg-%s'
resolve_conf_fn = "/etc/resolv.conf"
tz_local_fn = "/etc/localtime"
+ usr_lib_exec = "/usr/libexec"
def __init__(self, name, cfg, paths):
distros.Distro.__init__(self, name, cfg, paths)