summaryrefslogtreecommitdiff
path: root/cloudinit/config/cc_keys_to_console.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2014-11-25 11:54:51 -0800
committerJoshua Harlow <harlowja@yahoo-inc.com>2014-11-25 11:54:51 -0800
commit26af82a55325c460fdeb7eb6dceef7d433671e47 (patch)
treea7b2e972073d2de223b1bef7519f3122bef549d2 /cloudinit/config/cc_keys_to_console.py
parent1db41a6f5283d38dff6de0b0421d51eac869a39c (diff)
parent7b39b3976f94fd9ce9cbe39324ec14ad5a7c334e (diff)
downloadvyos-cloud-init-26af82a55325c460fdeb7eb6dceef7d433671e47.tar.gz
vyos-cloud-init-26af82a55325c460fdeb7eb6dceef7d433671e47.zip
Fixes rpm spec file build issues (its not currently building).
Currently the rpm building process that cloud-init provides is not working correctly. This adjusts the spec file, the setup.py file and the distro files to ensure that it continues to work as expected.
Diffstat (limited to 'cloudinit/config/cc_keys_to_console.py')
-rw-r--r--cloudinit/config/cc_keys_to_console.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/cloudinit/config/cc_keys_to_console.py b/cloudinit/config/cc_keys_to_console.py
index ed7af690..f1c1adff 100644
--- a/cloudinit/config/cc_keys_to_console.py
+++ b/cloudinit/config/cc_keys_to_console.py
@@ -26,13 +26,22 @@ 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 _get_helper_tool_path(distro):
+ try:
+ base_lib = distro.usr_lib_exec
+ except AttributeError:
+ base_lib = '/usr/lib'
+ return HELPER_TOOL_TPL % base_lib
+
+
+def handle(name, cfg, cloud, log, _args):
+ helper_path = _get_helper_tool_path(cloud.distro)
+ 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 +51,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)