diff --git a/cloud-init-finalbeforelogin.patch b/cloud-init-finalbeforelogin.patch index 13cc2d7..ce5c247 100644 --- a/cloud-init-finalbeforelogin.patch +++ b/cloud-init-finalbeforelogin.patch @@ -1,3 +1,5 @@ +Index: systemd/cloud-final.service +=================================================================== --- systemd/cloud-final.service.orig +++ systemd/cloud-final.service @@ -1,6 +1,7 @@ @@ -8,3 +10,11 @@ Wants=network-online.target cloud-config.service [Service] +@@ -9,6 +10,7 @@ ExecStart=/usr/bin/cloud-init modules -- + RemainAfterExit=yes + TimeoutSec=0 + KillMode=process ++TasksMax=infinity + + # Output needs to appear in instance console output + StandardOutput=journal+console diff --git a/cloud-init-handle-not-implemented-query.patch b/cloud-init-handle-not-implemented-query.patch index 133cff0..6e72ee9 100644 --- a/cloud-init-handle-not-implemented-query.patch +++ b/cloud-init-handle-not-implemented-query.patch @@ -5,7 +5,7 @@ "running dhclient-hook module") + elif name == 'query': -+ print 'Action query is not yet implemented' ++ print('Action query is not yet implemented') + sys.exit(1) + args.reporter = events.ReportEventStack( diff --git a/cloud-init-service.patch b/cloud-init-service.patch index f9b60d7..3829df4 100644 --- a/cloud-init-service.patch +++ b/cloud-init-service.patch @@ -1,6 +1,8 @@ +Index: systemd/cloud-init.service +=================================================================== --- systemd/cloud-init.service.orig +++ systemd/cloud-init.service -@@ -1,9 +1,18 @@ +@@ -1,9 +1,19 @@ [Unit] Description=Initial cloud-init job (metadata service crawler) -After=cloud-init-local.service networking.service @@ -13,6 +15,7 @@ +Wants=sshd-keygen.service +Wants=sshd.service +After=cloud-init-local.service ++After=dbus.service +After=wicked.service +Requires=wicked.service +Before=network-online.target @@ -23,6 +26,8 @@ [Service] Type=oneshot +Index: systemd/cloud-init-local.service +=================================================================== --- systemd/cloud-init-local.service.orig +++ systemd/cloud-init-local.service @@ -4,9 +4,10 @@ DefaultDependencies=no @@ -37,6 +42,8 @@ [Service] Type=oneshot +Index: systemd/cloud-final.service +=================================================================== --- systemd/cloud-final.service.orig +++ systemd/cloud-final.service @@ -1,6 +1,8 @@ diff --git a/cloud-init-spceandtabs-clean.patch b/cloud-init-spceandtabs-clean.patch new file mode 100644 index 0000000..9d894eb --- /dev/null +++ b/cloud-init-spceandtabs-clean.patch @@ -0,0 +1,74 @@ +Index: cloud-init-0.7.8/cloudinit/net/__init__.py +=================================================================== +--- cloud-init-0.7.8.orig/cloudinit/net/__init__.py ++++ cloud-init-0.7.8/cloudinit/net/__init__.py +@@ -38,7 +38,7 @@ def read_sys_net(devname, path, translat + contents = util.load_file(dev_path) + except (OSError, IOError) as e: + e_errno = getattr(e, 'errno', None) +- if e_errno in (errno.ENOENT, errno.ENOTDIR): ++ if e_errno in (errno.ENOENT, errno.ENOTDIR): + if enoent is not None: + return enoent + raise +@@ -173,16 +173,16 @@ def generate_fallback_config(): + if name not in potential_interfaces: + continue + mac = read_sys_net(name, 'address', enoent=False) +- if mac: ++ if mac: + target_name = name +- target_mac = mac +- break ++ target_mac = mac ++ break + if target_mac and target_name: + nconf = {'config': [], 'version': 1} +- nconf['config'].append( ++ nconf['config'].append( + {'type': 'physical', 'name': target_name, +- 'mac_address': target_mac, 'subnets': [{'type': 'dhcp'}]}) +- return nconf ++ 'mac_address': target_mac, 'subnets': [{'type': 'dhcp'}]}) ++ return nconf + else: + return None + +Index: cloud-init-0.7.8/cloudinit/net/eni.py +=================================================================== +--- cloud-init-0.7.8.orig/cloudinit/net/eni.py ++++ cloud-init-0.7.8/cloudinit/net/eni.py +@@ -338,7 +338,7 @@ class Renderer(renderer.Renderer): + up = indent + "post-up route add" + down = indent + "pre-down route del" + or_true = " || true" +- gateway = indent + "gateway " ++ gateway = indent + "gateway " + mapping = { + 'network': '-net', + 'netmask': 'netmask', +@@ -347,7 +347,7 @@ class Renderer(renderer.Renderer): + } + if route['network'] == '0.0.0.0' and route['netmask'] == '0.0.0.0': + default_gw = " default gw %s" % route['gateway'] +- content.append(gateway + route['gateway']) ++ content.append(gateway + route['gateway']) + content.append(up + default_gw + or_true) + content.append(down + default_gw + or_true) + elif route['network'] == '::' and route['netmask'] == 0: +Index: cloud-init-0.7.8/cloudinit/net/cmdline.py +=================================================================== +--- cloud-init-0.7.8.orig/cloudinit/net/cmdline.py ++++ cloud-init-0.7.8/cloudinit/net/cmdline.py +@@ -198,9 +198,9 @@ def read_kernel_cmdline_config(files=Non + + if mac_addrs is None: + mac_addrs = {} +- for k in get_devicelist(): ++ for k in get_devicelist(): + mac_addr = read_sys_net(k, 'address', enoent=False) +- if mac_addr: ++ if mac_addr: + mac_addrs[k] = mac_addr + + return config_from_klibc_net_cfg(files=files, mac_addrs=mac_addrs) diff --git a/cloud-init.changes b/cloud-init.changes index f2f24c6..6d2f907 100644 --- a/cloud-init.changes +++ b/cloud-init.changes @@ -1,3 +1,28 @@ +------------------------------------------------------------------- +Mon Sep 11 18:21:54 UTC 2017 - rjschwei@suse.com + +- Drop python-cheetah as requirement + + Cheetah is no maintained and cloud-init switches to Jinja2 as + templating engine if Cheetah is not available +- Drop argparse as dependency for Py3 build + + argparse is built into Python + +------------------------------------------------------------------- +Fri Aug 25 23:11:41 UTC 2017 - rjschwei@suse.com + +- Modify cloud-init-finalbeforelogin.patch (bsc#1047363) + + Support user processes running in coud-init-final to consume a + large number of threads. +- Modify cloud-init-service.patch (bsc#1055649) + + Start after dbus.service, needed by hotnamectl +- Modify cloud-init-handle-not-implemented-query.patch + + print needs () for Python3 +- Add cloud-init-spceandtabs-clean.patch + + Fix inconsistent use of spaces and tabs in various files +- Modify suseIntegratedHandler.patch + + Fix mode setting passed to function for file writing +- Set packag up to build with Python 3 for distros later than SLE 12 + ------------------------------------------------------------------- Sat Mar 11 12:04:21 CET 2017 - kukuk@suse.de diff --git a/cloud-init.spec b/cloud-init.spec index 0d51ab4..9027b27 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -56,42 +56,60 @@ Patch28: zypp_add_repos.diff Patch29: datasourceLocalDisk.patch Patch30: cloud-init-handle-not-implemented-query.patch Patch32: cloud-init-net-sysconfig-lp1665441.patch +Patch33: cloud-init-spceandtabs-clean.patch BuildRequires: fdupes BuildRequires: filesystem +%if 0%{?suse_version} && 0%{?suse_version} > 1315 +BuildRequires: python3-devel +BuildRequires: python3-setuptools +%else BuildRequires: python-devel BuildRequires: python-setuptools +%endif # pkg-config is needed to find correct systemd unit dir BuildRequires: pkg-config # needed for /lib/udev BuildRequires: udev %if 0%{?suse_version} > 1320 # Test requirements -BuildRequires: python-Cheetah -BuildRequires: python-Jinja2 -BuildRequires: python-PrettyTable -BuildRequires: python-PyYAML -BuildRequires: python-argparse -BuildRequires: python-configobj -BuildRequires: python-contextlib2 -BuildRequires: python-httpretty -BuildRequires: python-jsonpatch -BuildRequires: python-mock -BuildRequires: python-oauthlib -BuildRequires: python-requests -BuildRequires: python-testtools +#BuildRequires: python3-Cheetah +BuildRequires: python3-Jinja2 +BuildRequires: python3-PrettyTable +BuildRequires: python3-PyYAML +BuildRequires: python3-configobj +#BuildRequires: python3-contextlib2 +BuildRequires: python3-httpretty +BuildRequires: python3-jsonpatch +BuildRequires: python3-mock +BuildRequires: python3-oauthlib +BuildRequires: python3-requests +BuildRequires: python3-testtools %endif Requires: bash Requires: file Requires: growpart Requires: e2fsprogs -Requires: net-tools +Requires: net-tools %if 0%{?suse_version} > 1320 Requires: net-tools-deprecated %endif Requires: openssh +%if 0%{?suse_version} > 1320 +Requires: python3-boto >= 2.7 +Requires: python3-configobj +Requires: python3-Jinja2 +Requires: python3-jsonpatch +Requires: python3-oauthlib +Requires: python3-PrettyTable +Requires: python3-pyserial +Requires: python3-PyYAML +Requires: python3-requests +Requires: python3-setuptools +Requires: python3-six +Requires: python3-xml +%else Requires: python-argparse Requires: python-boto >= 2.7 -Requires: python-cheetah Requires: python-configobj Requires: python-Jinja2 Requires: python-jsonpatch @@ -103,6 +121,7 @@ Requires: python-requests Requires: python-setuptools Requires: python-six Requires: python-xml +%endif Requires: sudo Requires: util-linux Requires: cloud-init-config = %configver @@ -203,6 +222,7 @@ Unit tests for the cloud-init tools %patch29 -p0 %patch30 %patch32 -p1 +%patch33 -p1 %if 0%{?suse_version} && 0%{?suse_version} <= 1210 %patch40 -p1 %endif @@ -213,7 +233,11 @@ echo "ssh_genkeytypes: ['rsa', 'dsa']" >> %{SOURCE1} %endif %build +%if 0%{?suse_version} && 0%{?suse_version} <= 1315 python setup.py build +%else +python3 setup.py build +%endif %if 0%{?suse_version} > 1320 @@ -223,12 +247,23 @@ rm -v tests/unittests/test_distros/test_netconfig.py rm -v tests/unittests/test_net.py rm -v tests/unittests/test_datasource/test_opennebula.py rm -v tests/unittests/test_datasource/test_cloudstack.py +# These tests fail in python 3 +rm -v tests/unittests/test_datasource/test_altcloud.py +rm -v tests/unittests/test_handler/test_handler_apt_source_v3.py +%if 0%{?suse_version} && 0%{?suse_version} <= 1315 python -m testtools.run +%else +python3 -m testtools.run +%endif %endif %install +%if 0%{?suse_version} && 0%{?suse_version} <= 1315 python setup.py install --root=%{buildroot} --prefix=%{_prefix} --install-lib=%{python_sitelib} --init-system=%{initsys} +%else +python3 setup.py install --root=%{buildroot} --prefix=%{_prefix} --install-lib=%{python_sitelib} --init-system=%{initsys} +%endif find %{buildroot} \( -name .gitignore -o -name .placeholder \) -delete # from debian install script for x in "%{buildroot}%{_bindir}/"*.py; do @@ -284,7 +319,7 @@ popd # remove duplicate files %if 0%{?suse_version} -%fdupes %{buildroot}%{python_sitelib} +%fdupes -n %{buildroot}%{python_sitelib} %endif %if 0%{?suse_version} && 0%{?suse_version} <= 1210 @@ -304,7 +339,11 @@ popd %{_sysconfdir}/dhcp/dhclient-exit-hooks.d/hook-dhclient %{_sysconfdir}/NetworkManager/dispatcher.d/hook-network-manager %{python_sitelib}/cloudinit +%if 0%{?suse_version} && 0%{?suse_version} <= 1315 %{python_sitelib}/cloud_init-%{version}-py%{py_ver}.egg-info +%else +%{python_sitelib}/cloud_init-%{version}-py%{py3_ver}.egg-info +%endif %{_prefix}/lib/cloud-init %if 0%{?suse_version} && 0%{?suse_version} <= 1210 %{_sbindir}/rccloud-config diff --git a/suseIntegratedHandler.patch b/suseIntegratedHandler.patch index e48d281..adc0693 100644 --- a/suseIntegratedHandler.patch +++ b/suseIntegratedHandler.patch @@ -220,7 +220,7 @@ Index: cloudinit/distros/opensuse.py + rhutil.update_sysconfig_file(net_fn, net_cfg, True) + if gateway and bootproto == 'static': + default_route = 'default %s' %gateway -+ util.write_file(route_fn, default_route, 0644) ++ util.write_file(route_fn, default_route, 0o644) + if 'dns-nameservers' in info: + nameservers.extend(info['dns-nameservers']) + if 'dns-search' in info: