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.
This commit is contained in:
commit
f2d73d952b
@ -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)
|
||||
|
@ -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"
|
||||
|
@ -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)
|
||||
|
@ -244,6 +244,7 @@ def main():
|
||||
spec_fn = util.abs_join(root_dir, 'cloud-init.spec')
|
||||
util.write_file(spec_fn, contents)
|
||||
print("Created spec file at %r" % (spec_fn))
|
||||
print(contents)
|
||||
for p in args.patches:
|
||||
util.copy(p, util.abs_join(arc_dir, os.path.basename(p)))
|
||||
|
||||
|
@ -81,7 +81,7 @@ ssh keys and to let the user run various scripts.
|
||||
%{__python} setup.py build
|
||||
|
||||
%install
|
||||
rm -rf \$RPM_BUILD_ROOT
|
||||
|
||||
%{__python} setup.py install -O1 \
|
||||
--skip-build --root \$RPM_BUILD_ROOT \
|
||||
--init-system=${init_sys}
|
||||
@ -92,6 +92,13 @@ mkdir -p \$RPM_BUILD_ROOT/%{_sysconfdir}/rsyslog.d
|
||||
cp -p tools/21-cloudinit.conf \
|
||||
\$RPM_BUILD_ROOT/%{_sysconfdir}/rsyslog.d/21-cloudinit.conf
|
||||
|
||||
# Remove the tests
|
||||
rm -rf \$RPM_BUILD_ROOT%{python_sitelib}/tests
|
||||
|
||||
# Required dirs...
|
||||
mkdir -p \$RPM_BUILD_ROOT/%{_sharedstatedir}/cloud
|
||||
mkdir -p \$RPM_BUILD_ROOT/%{_libexecdir}/%{name}
|
||||
|
||||
#if $systemd
|
||||
mkdir -p \$RPM_BUILD_ROOT/%{_unitdir}
|
||||
cp -p systemd/* \$RPM_BUILD_ROOT/%{_unitdir}
|
||||
@ -166,15 +173,11 @@ fi
|
||||
|
||||
# Program binaries
|
||||
%{_bindir}/cloud-init*
|
||||
|
||||
# There doesn't seem to be an agreed upon place for these
|
||||
# although it appears the standard says /usr/lib but rpmbuild
|
||||
# will try /usr/lib64 ??
|
||||
/usr/lib/%{name}/uncloud-init
|
||||
/usr/lib/%{name}/write-ssh-key-fingerprints
|
||||
%{_libexecdir}/%{name}/uncloud-init
|
||||
%{_libexecdir}/%{name}/write-ssh-key-fingerprints
|
||||
|
||||
# Docs
|
||||
%doc TODO LICENSE ChangeLog requirements.txt
|
||||
%doc LICENSE ChangeLog TODO.rst requirements.txt
|
||||
%doc %{_defaultdocdir}/cloud-init/*
|
||||
|
||||
# Configs
|
||||
@ -185,7 +188,9 @@ fi
|
||||
%dir %{_sysconfdir}/cloud/templates
|
||||
%config(noreplace) %{_sysconfdir}/cloud/templates/*
|
||||
%config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf
|
||||
%config(noreplace) %{_sysconfdir}/sudoers.d/cloud-init
|
||||
|
||||
%{_libexecdir}/%{name}
|
||||
%dir %{_sharedstatedir}/cloud
|
||||
|
||||
# Python code is here...
|
||||
%{python_sitelib}/*
|
||||
|
6
setup.py
6
setup.py
@ -82,9 +82,13 @@ INITSYS_TYPES = sorted(list(INITSYS_ROOTS.keys()))
|
||||
# FreeBSD systems.
|
||||
USR = "/usr"
|
||||
ETC = "/etc"
|
||||
USR_LIB_EXEC = "/usr/lib"
|
||||
if os.uname()[0] == 'FreeBSD':
|
||||
USR = "/usr/local"
|
||||
USR_LIB_EXEC = "/usr/local/lib"
|
||||
ETC = "/usr/local/etc"
|
||||
elif os.path.isfile('/etc/redhat-release'):
|
||||
USR_LIB_EXEC = "/usr/libexec"
|
||||
|
||||
|
||||
# Avoid having datafiles installed in a virtualenv...
|
||||
@ -155,7 +159,7 @@ else:
|
||||
(ETC + '/cloud', glob('config/*.cfg')),
|
||||
(ETC + '/cloud/cloud.cfg.d', glob('config/cloud.cfg.d/*')),
|
||||
(ETC + '/cloud/templates', glob('templates/*')),
|
||||
(USR + '/lib/cloud-init', ['tools/uncloud-init',
|
||||
(USR_LIB_EXEC + '/cloud-init', ['tools/uncloud-init',
|
||||
'tools/write-ssh-key-fingerprints']),
|
||||
(USR + '/share/doc/cloud-init', [f for f in glob('doc/*') if is_f(f)]),
|
||||
(USR + '/share/doc/cloud-init/examples',
|
||||
|
Loading…
x
Reference in New Issue
Block a user