Accepting request 523370 from Cloud:Tools

- 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

- 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

OBS-URL: https://build.opensuse.org/request/show/523370
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/cloud-init?expand=0&rev=37
This commit is contained in:
Dominique Leuenberger 2017-09-12 17:56:07 +00:00 committed by Git OBS Bridge
commit e6b386982d
7 changed files with 174 additions and 19 deletions

View File

@ -1,3 +1,5 @@
Index: systemd/cloud-final.service
===================================================================
--- systemd/cloud-final.service.orig --- systemd/cloud-final.service.orig
+++ systemd/cloud-final.service +++ systemd/cloud-final.service
@@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
@ -8,3 +10,11 @@
Wants=network-online.target cloud-config.service Wants=network-online.target cloud-config.service
[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

View File

@ -5,7 +5,7 @@
"running dhclient-hook module") "running dhclient-hook module")
+ elif name == 'query': + elif name == 'query':
+ print 'Action query is not yet implemented' + print('Action query is not yet implemented')
+ sys.exit(1) + sys.exit(1)
+ +
args.reporter = events.ReportEventStack( args.reporter = events.ReportEventStack(

View File

@ -1,6 +1,8 @@
Index: systemd/cloud-init.service
===================================================================
--- systemd/cloud-init.service.orig --- systemd/cloud-init.service.orig
+++ systemd/cloud-init.service +++ systemd/cloud-init.service
@@ -1,9 +1,18 @@ @@ -1,9 +1,19 @@
[Unit] [Unit]
Description=Initial cloud-init job (metadata service crawler) Description=Initial cloud-init job (metadata service crawler)
-After=cloud-init-local.service networking.service -After=cloud-init-local.service networking.service
@ -13,6 +15,7 @@
+Wants=sshd-keygen.service +Wants=sshd-keygen.service
+Wants=sshd.service +Wants=sshd.service
+After=cloud-init-local.service +After=cloud-init-local.service
+After=dbus.service
+After=wicked.service +After=wicked.service
+Requires=wicked.service +Requires=wicked.service
+Before=network-online.target +Before=network-online.target
@ -23,6 +26,8 @@
[Service] [Service]
Type=oneshot Type=oneshot
Index: systemd/cloud-init-local.service
===================================================================
--- systemd/cloud-init-local.service.orig --- systemd/cloud-init-local.service.orig
+++ systemd/cloud-init-local.service +++ systemd/cloud-init-local.service
@@ -4,9 +4,10 @@ DefaultDependencies=no @@ -4,9 +4,10 @@ DefaultDependencies=no
@ -37,6 +42,8 @@
[Service] [Service]
Type=oneshot Type=oneshot
Index: systemd/cloud-final.service
===================================================================
--- systemd/cloud-final.service.orig --- systemd/cloud-final.service.orig
+++ systemd/cloud-final.service +++ systemd/cloud-final.service
@@ -1,6 +1,8 @@ @@ -1,6 +1,8 @@

View File

@ -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)

View File

@ -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 Sat Mar 11 12:04:21 CET 2017 - kukuk@suse.de

View File

@ -56,42 +56,60 @@ Patch28: zypp_add_repos.diff
Patch29: datasourceLocalDisk.patch Patch29: datasourceLocalDisk.patch
Patch30: cloud-init-handle-not-implemented-query.patch Patch30: cloud-init-handle-not-implemented-query.patch
Patch32: cloud-init-net-sysconfig-lp1665441.patch Patch32: cloud-init-net-sysconfig-lp1665441.patch
Patch33: cloud-init-spceandtabs-clean.patch
BuildRequires: fdupes BuildRequires: fdupes
BuildRequires: filesystem BuildRequires: filesystem
%if 0%{?suse_version} && 0%{?suse_version} > 1315
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%else
BuildRequires: python-devel BuildRequires: python-devel
BuildRequires: python-setuptools BuildRequires: python-setuptools
%endif
# pkg-config is needed to find correct systemd unit dir # pkg-config is needed to find correct systemd unit dir
BuildRequires: pkg-config BuildRequires: pkg-config
# needed for /lib/udev # needed for /lib/udev
BuildRequires: udev BuildRequires: udev
%if 0%{?suse_version} > 1320 %if 0%{?suse_version} > 1320
# Test requirements # Test requirements
BuildRequires: python-Cheetah #BuildRequires: python3-Cheetah
BuildRequires: python-Jinja2 BuildRequires: python3-Jinja2
BuildRequires: python-PrettyTable BuildRequires: python3-PrettyTable
BuildRequires: python-PyYAML BuildRequires: python3-PyYAML
BuildRequires: python-argparse BuildRequires: python3-configobj
BuildRequires: python-configobj #BuildRequires: python3-contextlib2
BuildRequires: python-contextlib2 BuildRequires: python3-httpretty
BuildRequires: python-httpretty BuildRequires: python3-jsonpatch
BuildRequires: python-jsonpatch BuildRequires: python3-mock
BuildRequires: python-mock BuildRequires: python3-oauthlib
BuildRequires: python-oauthlib BuildRequires: python3-requests
BuildRequires: python-requests BuildRequires: python3-testtools
BuildRequires: python-testtools
%endif %endif
Requires: bash Requires: bash
Requires: file Requires: file
Requires: growpart Requires: growpart
Requires: e2fsprogs Requires: e2fsprogs
Requires: net-tools Requires: net-tools
%if 0%{?suse_version} > 1320 %if 0%{?suse_version} > 1320
Requires: net-tools-deprecated Requires: net-tools-deprecated
%endif %endif
Requires: openssh 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-argparse
Requires: python-boto >= 2.7 Requires: python-boto >= 2.7
Requires: python-cheetah
Requires: python-configobj Requires: python-configobj
Requires: python-Jinja2 Requires: python-Jinja2
Requires: python-jsonpatch Requires: python-jsonpatch
@ -103,6 +121,7 @@ Requires: python-requests
Requires: python-setuptools Requires: python-setuptools
Requires: python-six Requires: python-six
Requires: python-xml Requires: python-xml
%endif
Requires: sudo Requires: sudo
Requires: util-linux Requires: util-linux
Requires: cloud-init-config = %configver Requires: cloud-init-config = %configver
@ -203,6 +222,7 @@ Unit tests for the cloud-init tools
%patch29 -p0 %patch29 -p0
%patch30 %patch30
%patch32 -p1 %patch32 -p1
%patch33 -p1
%if 0%{?suse_version} && 0%{?suse_version} <= 1210 %if 0%{?suse_version} && 0%{?suse_version} <= 1210
%patch40 -p1 %patch40 -p1
%endif %endif
@ -213,7 +233,11 @@ echo "ssh_genkeytypes: ['rsa', 'dsa']" >> %{SOURCE1}
%endif %endif
%build %build
%if 0%{?suse_version} && 0%{?suse_version} <= 1315
python setup.py build python setup.py build
%else
python3 setup.py build
%endif
%if 0%{?suse_version} > 1320 %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_net.py
rm -v tests/unittests/test_datasource/test_opennebula.py rm -v tests/unittests/test_datasource/test_opennebula.py
rm -v tests/unittests/test_datasource/test_cloudstack.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 python -m testtools.run
%else
python3 -m testtools.run
%endif
%endif %endif
%install %install
%if 0%{?suse_version} && 0%{?suse_version} <= 1315
python setup.py install --root=%{buildroot} --prefix=%{_prefix} --install-lib=%{python_sitelib} --init-system=%{initsys} 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 find %{buildroot} \( -name .gitignore -o -name .placeholder \) -delete
# from debian install script # from debian install script
for x in "%{buildroot}%{_bindir}/"*.py; do for x in "%{buildroot}%{_bindir}/"*.py; do
@ -284,7 +319,7 @@ popd
# remove duplicate files # remove duplicate files
%if 0%{?suse_version} %if 0%{?suse_version}
%fdupes %{buildroot}%{python_sitelib} %fdupes -n %{buildroot}%{python_sitelib}
%endif %endif
%if 0%{?suse_version} && 0%{?suse_version} <= 1210 %if 0%{?suse_version} && 0%{?suse_version} <= 1210
@ -304,7 +339,11 @@ popd
%{_sysconfdir}/dhcp/dhclient-exit-hooks.d/hook-dhclient %{_sysconfdir}/dhcp/dhclient-exit-hooks.d/hook-dhclient
%{_sysconfdir}/NetworkManager/dispatcher.d/hook-network-manager %{_sysconfdir}/NetworkManager/dispatcher.d/hook-network-manager
%{python_sitelib}/cloudinit %{python_sitelib}/cloudinit
%if 0%{?suse_version} && 0%{?suse_version} <= 1315
%{python_sitelib}/cloud_init-%{version}-py%{py_ver}.egg-info %{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 %{_prefix}/lib/cloud-init
%if 0%{?suse_version} && 0%{?suse_version} <= 1210 %if 0%{?suse_version} && 0%{?suse_version} <= 1210
%{_sbindir}/rccloud-config %{_sbindir}/rccloud-config

View File

@ -220,7 +220,7 @@ Index: cloudinit/distros/opensuse.py
+ rhutil.update_sysconfig_file(net_fn, net_cfg, True) + rhutil.update_sysconfig_file(net_fn, net_cfg, True)
+ if gateway and bootproto == 'static': + if gateway and bootproto == 'static':
+ default_route = 'default %s' %gateway + 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: + if 'dns-nameservers' in info:
+ nameservers.extend(info['dns-nameservers']) + nameservers.extend(info['dns-nameservers'])
+ if 'dns-search' in info: + if 'dns-search' in info: