From 8e9fedcf491103e8d7298f73e54db7b13989751fc0d52bba9e6e5f2e7bd861b8 Mon Sep 17 00:00:00 2001 From: Robert Schweikert Date: Tue, 13 Sep 2016 16:56:10 +0000 Subject: [PATCH] - update to version 0.7.8 (bsc#998103) + added cloud-init-net-eni.patch based on work by eblock - Using config-drive instead of metadata failed because the network translation to Ubuntu-style did not return gateway information to opensuse.py + added cloud-init-service.patch based on work by eblock - The service file cloud-init.service referenced networking.service which on SUSE is network.service + remove no_logic_change.patch included in updated upstream source + forward port suseIntegratedHandler.patch + forward port setupSUSEsysVInit.diff + forward port cloud-init-no-dmidecode-on-ppc64.patch + foward port dataSourceOpenNebula.patch + forward port fix-default-systemd-unit-dir.patch + forward port cloud-init-finalbeforelogin.patch + forward port cloud-init-python2-sigpipe.patch + SmartOS: more improvements for network configuration + add ntp config module [Ryan Harper] + ChangeLog: update changelog for previous commit. + Add distro tags on config modules that should have it. + NoCloud: fix bug providing network-interfaces via meta-data. (LP: 1577982) + ConfigDrive: recognize 'tap' as a link type. (LP: #1610784) + Upgrade to a configobj package new enough to work + MAAS: add vendor-data support (LP: #1612313) + DigitalOcean: use the v1.json endpoint [Ben Howard] + Get Azure endpoint server from DHCP client [Brent Baude] + Apt: add new apt configuration format [Christian Ehrhardt] + distros: fix get_primary_arch method use of os.uname [Andrew Jorgensen] + Fix Gentoo net config generation [Matthew Thode] + Minor cleanups to atomic_helper and add unit tests. OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=43 --- cloud-init-0.7.6.tar.gz | 3 - cloud-init-0.7.8.tar.gz | 3 + cloud-init-finalbeforelogin.patch | 6 +- cloud-init-net-eni.patch | 18 +++ cloud-init-no-dmidecode-on-ppc64.patch | 33 ++--- cloud-init-python2-sigpipe.patch | 32 +++-- cloud-init-service.patch | 13 ++ cloud-init.changes | 180 +++++++++++++++++++++++++ cloud-init.spec | 27 +++- dataSourceOpenNebula.patch | 75 +++++------ fix-default-systemd-unit-dir.patch | 26 ++-- no_logic_change.patch | 22 --- setupSUSEsysVInit.diff | 26 ++-- suseIntegratedHandler.patch | 44 ++---- 14 files changed, 335 insertions(+), 173 deletions(-) delete mode 100644 cloud-init-0.7.6.tar.gz create mode 100644 cloud-init-0.7.8.tar.gz create mode 100644 cloud-init-net-eni.patch create mode 100644 cloud-init-service.patch delete mode 100644 no_logic_change.patch diff --git a/cloud-init-0.7.6.tar.gz b/cloud-init-0.7.6.tar.gz deleted file mode 100644 index 9d2d6fc..0000000 --- a/cloud-init-0.7.6.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9e8fd22eb7f6e40ae6a5f66173ddc3cc18f65ee406c460a728092b37db2f3ed7 -size 515670 diff --git a/cloud-init-0.7.8.tar.gz b/cloud-init-0.7.8.tar.gz new file mode 100644 index 0000000..659c657 --- /dev/null +++ b/cloud-init-0.7.8.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4a4f1f7fb9dd0987a02aa7cd6f609910294fce8f9724dcebc0cd88630b4f1fd6 +size 508777 diff --git a/cloud-init-finalbeforelogin.patch b/cloud-init-finalbeforelogin.patch index 3fbafba..13cc2d7 100644 --- a/cloud-init-finalbeforelogin.patch +++ b/cloud-init-finalbeforelogin.patch @@ -3,8 +3,8 @@ @@ -1,6 +1,7 @@ [Unit] Description=Execute cloud user/final scripts - After=network.target syslog.target cloud-config.service rc-local.service + After=network-online.target cloud-config.service rc-local.service multi-user.target +Before=systemd-logind.service - Requires=cloud-config.target - Wants=network.target + Wants=network-online.target cloud-config.service + [Service] diff --git a/cloud-init-net-eni.patch b/cloud-init-net-eni.patch new file mode 100644 index 0000000..f8cbea6 --- /dev/null +++ b/cloud-init-net-eni.patch @@ -0,0 +1,18 @@ +--- cloudinit/net/eni.py.orig ++++ cloudinit/net/eni.py +@@ -338,6 +338,7 @@ class Renderer(renderer.Renderer): + up = indent + "post-up route add" + down = indent + "pre-down route del" + or_true = " || true" ++ gateway = indent + "gateway " + mapping = { + 'network': '-net', + 'netmask': 'netmask', +@@ -346,6 +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(up + default_gw + or_true) + content.append(down + default_gw + or_true) + elif route['network'] == '::' and route['netmask'] == 0: diff --git a/cloud-init-no-dmidecode-on-ppc64.patch b/cloud-init-no-dmidecode-on-ppc64.patch index 7509f59..72e1827 100644 --- a/cloud-init-no-dmidecode-on-ppc64.patch +++ b/cloud-init-no-dmidecode-on-ppc64.patch @@ -1,26 +1,11 @@ -Index: cloud-init-0.7.5/cloudinit/sources/DataSourceAltCloud.py -=================================================================== ---- cloud-init-0.7.5.orig/cloudinit/sources/DataSourceAltCloud.py -+++ cloud-init-0.7.5/cloudinit/sources/DataSourceAltCloud.py -@@ -116,7 +116,7 @@ class DataSourceAltCloud(sources.DataSou - ''' +--- cloudinit/util.py.orig ++++ cloudinit/util.py +@@ -2337,7 +2337,7 @@ def read_dmi_data(key): - uname_arch = os.uname()[4] -- if uname_arch.startswith("arm") or uname_arch == "aarch64": -+ if uname_arch.startswith("arm") or uname_arch == "aarch64" or uname_arch.startswith("ppc"): - # Disabling because dmidecode in CMD_DMI_SYSTEM crashes kvm process - LOG.debug("Disabling AltCloud datasource on arm (LP: #1243287)") - return 'UNKNOWN' -Index: cloud-init-0.7.5/cloudinit/sources/DataSourceSmartOS.py -=================================================================== ---- cloud-init-0.7.5.orig/cloudinit/sources/DataSourceSmartOS.py -+++ cloud-init-0.7.5/cloudinit/sources/DataSourceSmartOS.py -@@ -175,7 +175,7 @@ class DataSourceSmartOS(sources.DataSour - return False + # running dmidecode can be problematic on some arches (LP: #1243287) + uname_arch = os.uname()[4] +- if uname_arch.startswith("arm") or uname_arch == "aarch64": ++ if uname_arch.startswith("arm") or uname_arch == "aarch64" or uname_arch.startswith("ppc"): + LOG.debug("dmidata is not supported on %s", uname_arch) + return None - uname_arch = os.uname()[4] -- if uname_arch.startswith("arm") or uname_arch == "aarch64": -+ if uname_arch.startswith("arm") or uname_arch == "aarch64" or uname_arch.startswith("ppc"): - # Disabling because dmidcode in dmi_data() crashes kvm process - LOG.debug("Disabling SmartOS datasource on arm (LP: #1243287)") - return False diff --git a/cloud-init-python2-sigpipe.patch b/cloud-init-python2-sigpipe.patch index 2a6858e..a2094e8 100644 --- a/cloud-init-python2-sigpipe.patch +++ b/cloud-init-python2-sigpipe.patch @@ -1,22 +1,20 @@ -Index: cloud-init-0.7.6/cloudinit/util.py -=================================================================== ---- cloud-init-0.7.6.orig/cloudinit/util.py -+++ cloud-init-0.7.6/cloudinit/util.py -@@ -59,6 +59,7 @@ from cloudinit import version - - from cloudinit.settings import (CFG_BUILTIN) +--- cloudinit/util.py.orig ++++ cloudinit/util.py +@@ -46,6 +46,7 @@ import tempfile + import time + from base64 import b64decode, b64encode +from signal import signal, SIGPIPE, SIG_DFL + from six.moves.urllib import parse as urlparse + + import six +@@ -1802,7 +1803,8 @@ def subp(args, data=None, rcs=None, env= - _DNS_REDIRECT_IP = None - LOG = logging.getLogger(__name__) -@@ -1559,7 +1560,8 @@ def subp(args, data=None, rcs=None, env= - stdin = subprocess.PIPE sp = subprocess.Popen(args, stdout=stdout, - stderr=stderr, stdin=stdin, -- env=env, shell=shell) -+ env=env, shell=shell, -+ preexec_fn=lambda: signal(SIGPIPE, SIG_DFL)) + stderr=stderr, stdin=stdin, +- env=env, shell=shell) ++ env=env, shell=shell, ++ preexec_fn=lambda: signal(SIGPIPE, SIG_DFL)) (out, err) = sp.communicate(data) - except OSError as e: - raise ProcessExecutionError(cmd=args, reason=e) + + # Just ensure blank instead of none. diff --git a/cloud-init-service.patch b/cloud-init-service.patch new file mode 100644 index 0000000..d4186ee --- /dev/null +++ b/cloud-init-service.patch @@ -0,0 +1,13 @@ +--- systemd/cloud-init.service.orig ++++ systemd/cloud-init.service +@@ -1,8 +1,8 @@ + [Unit] + Description=Initial cloud-init job (metadata service crawler) +-After=cloud-init-local.service networking.service ++After=cloud-init-local.service network.service + Before=network-online.target sshd.service sshd-keygen.service systemd-user-sessions.service +-Requires=networking.service ++Requires=networ.service + Wants=local-fs.target cloud-init-local.service sshd.service sshd-keygen.service + + [Service] diff --git a/cloud-init.changes b/cloud-init.changes index f749332..60755f5 100644 --- a/cloud-init.changes +++ b/cloud-init.changes @@ -1,3 +1,183 @@ +------------------------------------------------------------------- +Tue Sep 13 13:19:51 UTC 2016 - rjschwei@suse.com + +- update to version 0.7.8 (bsc#998103) + + added cloud-init-net-eni.patch based on work by eblock + - Using config-drive instead of metadata failed because the network + translation to Ubuntu-style did not return gateway information to + opensuse.py + + added cloud-init-service.patch based on work by eblock + - The service file cloud-init.service referenced networking.service + which on SUSE is network.service + + remove no_logic_change.patch included in updated upstream source + + forward port suseIntegratedHandler.patch + + forward port setupSUSEsysVInit.diff + + forward port cloud-init-no-dmidecode-on-ppc64.patch + + foward port dataSourceOpenNebula.patch + + forward port fix-default-systemd-unit-dir.patch + + forward port cloud-init-finalbeforelogin.patch + + forward port cloud-init-python2-sigpipe.patch + + SmartOS: more improvements for network configuration + + add ntp config module [Ryan Harper] + + ChangeLog: update changelog for previous commit. + + Add distro tags on config modules that should have it. + + NoCloud: fix bug providing network-interfaces via meta-data. (LP: 1577982) + + ConfigDrive: recognize 'tap' as a link type. (LP: #1610784) + + Upgrade to a configobj package new enough to work + + MAAS: add vendor-data support (LP: #1612313) + + DigitalOcean: use the v1.json endpoint [Ben Howard] + + Get Azure endpoint server from DHCP client [Brent Baude] + + Apt: add new apt configuration format [Christian Ehrhardt] + + distros: fix get_primary_arch method use of os.uname [Andrew Jorgensen] + + Fix Gentoo net config generation [Matthew Thode] + + Minor cleanups to atomic_helper and add unit tests. + + azure dhclient-hook cleanups + + network: fix get_interface_mac for bond slave, read_sys_net for ENOTDIR + + Generate a dummy bond name for OpenStack (LP: #1605749) + + add install option for openrc [Matthew Thode] + + Add a module that can configure spacewalk. + + python2.6: fix dict comprehension usage in _lsb_release. + + apt-config: allow both old and new format to be present. + [Christian Ehrhardt] (LP: #1616831) + + bddeb: add --release flag to specify the release in changelog. + + salt minion: update default pki directory for newer salt minion. + (LP: #1609899) + + Fix typo in default keys for phone_home [Roland Sommer] (LP: #1607810) + + apt config conversion: treat empty string as not provided. (LP: #1621180) + + tests: cleanup tempdirs in apt_source tests + + systemd: Better support package and upgrade. (LP: #1576692, #1621336) + + remove obsolete .bzrignore + + DataSourceOVF: fix user-data as base64 with python3 (LP: #1619394) + + Allow link type of null in network_data.json [Jon Grimm] (LP: #1621968) +from 0.7.7: + + Digital Ocean: add datasource for Digital Ocean. [Neal Shrader] + + expose uses_systemd as a distro function (fix rhel7) + + fix broken 'output' config (LP: #1387340) + + begin adding cloud config module docs to config modules (LP: #1383510) + + retain trailing eol from template files (sources.list) when + rendered with jinja (LP: #1355343) + + Only use datafiles and initsys addon outside virtualenvs + + Fix the digital ocean test case on python 2.6 + + Increase the usefulness, robustness, configurability of the chef module + so that it is more useful, more documented and better for users + + Fix how '=' signs are not handled that well in ssh_utils (LP: #1391303) + + Be more tolerant of ssh keys passed into 'ssh_authorized_keys'; allowing + for list, tuple, set, dict, string types and warning on other unexpected + types + + Update to use newer/better OMNIBUS_URL for chef module + + GCE: Allow base64 encoded user-data (LP: #1404311) [Wayne Witzell III] + + GCE: use short hostname rather than fqdn (LP: #1383794) [Ben Howard] + + systemd: make init stage run before login prompts shown [Steve Langasek] + + hostname: on first boot apply hostname to be same as is written for + persistent hostname. (LP: #1246485) + + remove usage of dmidecode on linux in favor of /sys interface [Ben Howard] + + python3 support [Barry Warsaw, Daniel Watkins, Josh Harlow] (LP: #1247132) + + support managing gpt partitions in disk config [Daniel Watkins] + + Azure: utilze gpt support for ephemeral formating [Daniel Watkins] + + CloudStack: support fetching password from virtual router [Daniel Watkins] + (LP: #1422388) + + readurl, read_file_or_url returns bytes, user must convert as necessary + + SmartOS: use v2 metadata service (LP: #1436417) [Daniel Watkins] + + NoCloud: fix local datasource claiming found without explicit dsmode + + Snappy: add support for installing snappy packages and configuring. + + systemd: use network-online instead of network.target (LP: #1440180) + [Steve Langasek] + + Add functionality to fixate the uid of a newly added user. + + Don't overwrite the hostname if the user has changed it after we set it. + + GCE datasource does not handle instance ssh keys (LP: 1403617) + + sysvinit: make cloud-init-local run before network (LP: #1275098) + [Surojit Pathak] + + Azure: do not re-set hostname if user has changed it (LP: #1375252) + + Fix exception when running with no arguments on Python 3. [Daniel Watkins] + + Centos: detect/expect use of systemd on centos 7. [Brian Rak] + + Azure: remove dependency on walinux-agent [Daniel Watkins] + + EC2: know about eu-central-1 availability-zone (LP: #1456684) + + Azure: remove password from on-disk ovf-env.xml (LP: #1443311) [Ben Howard] + + Doc: include information on user-data in OpenStack [Daniel Watkins] + + Systemd: check for systemd using sd_booted symantics (LP: #1461201) + [Lars Kellogg-Stedman] + + Add an rh_subscription module to handle registration of Red Hat instances. + [Brent Baude] + + cc_apt_configure: fix importing keys under python3 (LP: #1463373) + + cc_growpart: fix specification of 'devices' list (LP: #1465436) + + CloudStack: fix password setting on cloudstack > 4.5.1 (LP: #1464253) + + GCE: fix determination of availability zone (LP: #1470880) + + ssh: generate ed25519 host keys (LP: #1461242) + + distro mirrors: provide datasource to mirror selection code to support + GCE regional mirrors. (LP: #1470890) + + add udev rules that identify ephemeral device on Azure (LP: #1411582) + + _read_dmi_syspath: fix bad log message causing unintended exception + + rsyslog: add additional configuration mode (LP: #1478103) + + status_wrapper in main: fix use of print_exc when handling exception + + reporting: add reporting module for web hook or logging of events. + + NoCloud: fix consumption of vendordata (LP: #1493453) + + power_state_change: support 'condition' to disable or enable poweroff + + ubuntu fan: support for config and installing of ubuntu fan (LP: #1504604) + + Azure: support extracting SSH key values from ovf-env.xml (LP: #1506244) + + AltCloud: fix call to udevadm settle (LP: #1507526) + + Ubuntu templates: modify sources.list template to provide same sources + as install from server or desktop ISO. (LP: #1177432) + + cc_mounts: use 'nofail' if system uses systemd. (LP: #1514485) + + Azure: get instance id from dmi instead of SharedConfig (LP: #1506187) + + systemd/power_state: fix power_state to work even if cloud-final + exited non-zero (LP: #1449318) + + SmartOS: Add support for Joyent LX-Brand Zones (LP: #1540965) + [Robert C Jennings] + + systemd: support using systemd-detect-virt to detect container + (LP: #1539016) [Martin Pitt] + + docs: fix lock_passwd documentation [Robert C Jennings] + + Azure: Handle escaped quotes in WALinuxAgentShim.find_endpoint. + (LP: #1488891) [Dan Watkins] + + lxd: add support for setting up lxd using 'lxd init' (LP: #1522879) + + Add Image Customization Parser for VMware vSphere Hypervisor + Support. [Sankar Tanguturi] + + timezone: use a symlink rather than copy for /etc/localtime + unless it is already a file (LP: #1543025). + + Enable password changing via a hashed string [Alex Sirbu] + + Added BigStep datasource [Alex Sirbu] + + No longer run pollinate in seed_random (LP: #1554152) + + groups: add defalt user to 'lxd' group. Create groups listed + for a user if they do not exist. (LP: #1539317) + + dmi data: fix failure of reading dmi data for unset dmi values + + doc: mention label for nocloud datasource must be 'cidata' [Peter Hurley] + + ssh_pwauth: fix module to support 'unchanged' and match behavior + described in documentation [Chris Cosby] + + quickly check to see if the previous instance id is still valid to + avoid dependency on network metadata service on every boot (LP: #1553815) + + support network configuration in cloud-init --local with support + device naming via systemd.link. + + FreeBSD: add support for installing packages, setting password and + timezone. Change default user to 'freebsd'. [Ben Arblaster] + + locale: list unsupported environment settings in warning (LP: #1558069) + + disk_setup: correctly send --force to mkfs on block devices (LP: #1548772) + + chef: fix chef install from gems (LP: #1553345) + + systemd: do not specify After of obsolete syslog.target (LP: #1536964) + + centos: Ensure that resolve conf object is written as a str (LP: #1479988) + + chef: straighten out validation_cert and validation_key (LP: #1568940) + + phone_home: allow usage of fqdn (LP: #1566824) [Ollie Armstrong] + + cloudstack: Only use DHCPv4 lease files as a datasource (LP: #1576273) + [Wido den Hollander] + + Paths: fix instance path if datasource's id has a '/'. (LP: #1575938) + [Robert Jennings] + + Ec2: do not retry requests for user-data path on 404. + + settings on the kernel command line (cc:) override all local settings + rather than only those in /etc/cloud/cloud.cfg (LP: #1582323) + + Improve merging documentation [Daniel Watkins] + + apt sources: support inserting key/key-id only, custom sources.list, + long gpg key fingerprints with spaces, and dictionary format (LP: #1574113) + + SmartOS: datasource improvements and support for metadata service + providing networking information. + + Datasources: centrally handle 'dsmode' and no longer require datasources + to "pass" if modules_init should be executed with network access. + + ConfigDrive: improved support for networking information from + a network_data.json or older interfaces formated network_config. + + Change missing Cheetah log warning to debug [Andrew Jorgensen] + + Remove trailing dot from GCE metadata URL (LP: #1581200) [Phil Roche] + + support network rendering to sysconfig (for centos and RHEL) + + write_files: if no permissions are given, just use default without warn. + + user_data: fix error when user-data is not utf-8 decodable (LP: #1532072) + + fix mcollective module with python3 (LP: #1597699) [Sergii Golovatiuk] + ------------------------------------------------------------------- Mon Jun 6 09:43:12 UTC 2016 - joachim.gleissner@suse.com diff --git a/cloud-init.spec b/cloud-init.spec index 3e4ff91..f5e7910 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -16,7 +16,7 @@ # Name: cloud-init -Version: 0.7.6 +Version: 0.7.8 Release: 0 License: GPL-3.0 Summary: Cloud node initialization tool @@ -39,10 +39,11 @@ Patch9: cloud-init-no-dmidecode-on-ppc64.patch Patch10: cloud-init-no-user-lock-if-already-locked.patch Patch11: dataSourceOpenNebula.patch Patch12: fix-default-systemd-unit-dir.patch -Patch13: no_logic_change.patch Patch14: cloud-init-finalbeforelogin.patch # python2 disables SIGPIPE, causing broken pipe errors in shell scripts (bsc#903449) Patch20: cloud-init-python2-sigpipe.patch +Patch21: cloud-init-net-eni.patch +Patch22: cloud-init-service.patch BuildRequires: fdupes BuildRequires: filesystem BuildRequires: python-devel @@ -134,16 +135,17 @@ Unit tests for the cloud-init tools %patch0 -p1 %patch1 -p1 %patch2 -%patch3 -p1 +%patch3 %patch5 %patch6 -%patch9 -p1 +%patch9 %patch10 -p1 -%patch11 -p2 +%patch11 %patch12 -%patch13 %patch14 -%patch20 -p1 +%patch20 +%patch21 +%patch22 %if 0%{?suse_version} <= 1130 # disable ecdsa for SLE 11 (not available) @@ -221,6 +223,8 @@ popd %{_bindir}/cloud-init %{_bindir}/cloud-init-per %config(noreplace) %{_sysconfdir}/cloud/ +%{_sysconfdir}/dhcp/dhclient-exit-hooks.d/hook-dhclient +%{_sysconfdir}/NetworkManager/dispatcher.d/hook-network-manager %{python_sitelib}/cloudinit %{python_sitelib}/cloud_init-%{version}-py%{py_ver}.egg-info %{_prefix}/lib/cloud-init @@ -234,18 +238,27 @@ popd %attr(0755, root, root) %{_initddir}/cloud-init-local %attr(0755, root, root) %{_initddir}/cloud-final %else +%{systemd_prefix}/systemd/system-generators/cloud-init-generator %{systemd_prefix}/systemd/system/cloud-config.service %{systemd_prefix}/systemd/system/cloud-config.target %{systemd_prefix}/systemd/system/cloud-init-local.service %{systemd_prefix}/systemd/system/cloud-init.service +%{systemd_prefix}/systemd/system/cloud-init.target %{systemd_prefix}/systemd/system/cloud-final.service %endif %if 0%{?suse_version} && 0%{?suse_version} > 1110 %dir %{_sysconfdir}/rsyslog.d %{_sysconfdir}/rsyslog.d/21-cloudinit.conf %endif +/lib/udev/rules.d/66-azure-ephemeral.rules %dir %attr(0755, root, root) %{_localstatedir}/lib/cloud %dir %{docdir} +%dir /etc/NetworkManager +%dir /etc/NetworkManager/dispatcher.d +%dir /etc/dhcp +%dir /etc/dhcp/dhclient-exit-hooks.d +%dir /lib/udev +%dir /lib/udev/rules.d %files doc diff --git a/dataSourceOpenNebula.patch b/dataSourceOpenNebula.patch index e4cfee2..2dba4ce 100644 --- a/dataSourceOpenNebula.patch +++ b/dataSourceOpenNebula.patch @@ -1,45 +1,41 @@ -diff -Nurb suse/opensuse-13.2-orig/cloudinit/sources/DataSourceOpenNebula.py suse/opensuse-13.2-opennebula-patch/cloudinit/sources/DataSourceOpenNebula.py ---- suse/opensuse-13.2-orig/cloudinit/sources/DataSourceOpenNebula.py 2015-02-21 18:33:37.148247653 +0200 -+++ suse/opensuse-13.2-opennebula-patch/cloudinit/sources/DataSourceOpenNebula.py 2015-02-21 19:45:29.535835879 +0200 -@@ -149,7 +149,7 @@ +--- cloudinit/sources/DataSourceOpenNebula.py.orig ++++ cloudinit/sources/DataSourceOpenNebula.py +@@ -121,7 +121,7 @@ class BrokenContextDiskDir(Exception): class OpenNebulaNetwork(object): REG_DEV_MAC = re.compile( -- r'^\d+: (eth\d+):.*?link\/ether (..:..:..:..:..:..) ?', -+ r'^\d+: (\w+):.*?link\/\w+ (..:..:..:..:..:..) ?', - re.MULTILINE | re.DOTALL) +- r'^\d+: (eth\d+):.*?link\/ether (..:..:..:..:..:..) ?', ++ r'^\d+: (eth\d+):.*?link\/\W+ (..:..:..:..:..:..) ?', + re.MULTILINE | re.DOTALL) def __init__(self, ip, context): -@@ -158,7 +158,11 @@ +@@ -130,12 +130,24 @@ class OpenNebulaNetwork(object): self.ifaces = self.get_ifaces() def get_ifaces(self): - return self.REG_DEV_MAC.findall(self.ip) -+ list = self.REG_DEV_MAC.findall(self.ip) -+ ifaces = dict() -+ for l in list: -+ ifaces[l[1]] = l[0] ++ list = self.REG_DEV_MAC.findall(self.ip) ++ ifaces = dict() ++ for l in list: ++ ifaces[l[1]] = l[0] + return ifaces def mac2ip(self, mac): components = mac.split(':')[2:] -@@ -206,6 +210,15 @@ - else: - return None + return [str(int(c, 16)) for c in components] + def get_context_interfaces(self): -+ -+ def device_mac(t): return re.match(r"ETH\d+_MAC", t) ++ ++ def device_mac(t): return re.match(r"ETH\d+_MAC", t) + + mac_vars = filter(device_mac, self.context.keys()) ++ context_interfaces = [v.split('_')[0] for v in mac_vars] ++ return context_interfaces + -+ context_interfaces = [v.split('_')[0] for v in mac_vars] -+ return context_interfaces -+ - def gen_conf(self): - global_dns = [] - if 'DNS' in self.context: -@@ -216,27 +229,39 @@ + def get_ip(self, dev, components): + var_name = dev.upper() + '_IP' + if var_name in self.context: +@@ -188,27 +200,39 @@ class OpenNebulaNetwork(object): conf.append('iface lo inet loopback') conf.append('') @@ -48,18 +44,18 @@ diff -Nurb suse/opensuse-13.2-orig/cloudinit/sources/DataSourceOpenNebula.py sus - mac = i[1] + context_interfaces = self.get_context_interfaces() + -+ if len(context_interfaces): -+ try: -+ (out, _err) = util.subp(["systemctl", "stop", "NetworkManager"]) -+ (out, _err) = util.subp(["systemctl", "disable", "NetworkManager"]) -+ except util.ProcessExecutionError: -+ util.logexc(LOG, "Disable NetworkManager command failed") ++ if len(context_interfaces): ++ try: ++ (out, _err) = util.subp(["systemctl", "stop", "NetworkManager"]) ++ (out, _err) = util.subp(["systemctl", "disable", "NetworkManager"]) ++ except util.ProcessExecutionError: ++ util.logexc(LOG, "Disable NetworkManager command failed") + -+ for interface in context_interfaces: ++ for interface in context_interfaces: + mac = self.context[interface+"_MAC"] + dev = self.ifaces.get(mac) -+ if dev is None: -+ continue ++ if dev is None: ++ continue + ip_components = self.mac2ip(mac) @@ -68,7 +64,7 @@ diff -Nurb suse/opensuse-13.2-orig/cloudinit/sources/DataSourceOpenNebula.py sus - conf.append(' address ' + self.get_ip(dev, ip_components)) - conf.append(' network ' + self.get_network(dev, ip_components)) - conf.append(' netmask ' + self.get_mask(dev)) -+ conf.append(' address ' + self.get_ip(interface, ip_components)) ++ conf.append(' address ' + self.get_ip(nterface, ip_components)) + conf.append(' network ' + self.get_network(interface, ip_components)) + conf.append(' netmask ' + self.get_mask(interface)) @@ -84,18 +80,19 @@ diff -Nurb suse/opensuse-13.2-orig/cloudinit/sources/DataSourceOpenNebula.py sus # add global DNS servers to all interfaces - dns = self.get_dns(dev) -+ dns = self.get_dns(interface) ++ dns = self.get_dns(interface if global_dns or dns: all_dns = global_dns if dns: -@@ -404,8 +429,8 @@ +@@ -375,9 +399,8 @@ def read_context_disk_dir(source_dir, as if ssh_key_var: lines = context.get(ssh_key_var).splitlines() - results['metadata']['public-keys'] = [l for l in lines -- if len(l) and not l.startswith("#")] -+ ssh_keys = [l for l in lines if len(l) and not l.startswith("#")] -+ results['metadata']['public-keys'] = ssh_keys +- if len(l) and not +- l.startswith("#")] ++ ssh_keys = [l for l in lines if len(l) and not l.startswith("#")] ++ results['metadata']['public-keys'] = ssh_keys # custom hostname -- try hostname or leave cloud-init # itself create hostname from IP address later diff --git a/fix-default-systemd-unit-dir.patch b/fix-default-systemd-unit-dir.patch index 50d8930..a6e6268 100644 --- a/fix-default-systemd-unit-dir.patch +++ b/fix-default-systemd-unit-dir.patch @@ -1,13 +1,13 @@ -=== modified file 'setup.py' ---- setup.py 2015-01-21 20:28:32 +0000 -+++ setup.py 2015-04-13 09:20:40 +0000 -@@ -60,7 +60,7 @@ - try: - (path, err) = tiny_p(cmd) - except: -- return '/lib/systemd/system' -+ return '/usr/lib/systemd/system' - return str(path).strip() - - INITSYS_FILES = { - +--- setup.py.orig ++++ setup.py +@@ -58,8 +58,8 @@ def tiny_p(cmd, capture=True): + def pkg_config_read(library, var): + fallbacks = { + 'systemd': { +- 'systemdsystemunitdir': '/lib/systemd/system', +- 'systemdsystemgeneratordir': '/lib/systemd/system-generators', ++ 'systemdsystemunitdir': '/usr/lib/systemd/system', ++ 'systemdsystemgeneratordir': '/usr/lib/systemd/system-generators', + } + } + cmd = ['pkg-config', '--variable=%s' % var, library] diff --git a/no_logic_change.patch b/no_logic_change.patch deleted file mode 100644 index a79c9ac..0000000 --- a/no_logic_change.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- cloudinit/config/cc_rightscale_userdata.py.orig -+++ cloudinit/config/cc_rightscale_userdata.py -@@ -58,7 +58,7 @@ def handle(name, _cfg, cloud, log, _args - - try: - mdict = parse_qs(ud) -- if mdict or MY_HOOKNAME not in mdict: -+ if not mdict or MY_HOOKNAME not in mdict: - log.debug(("Skipping module %s, " - "did not find %s in parsed" - " raw userdata"), name, MY_HOOKNAME) ---- cloudinit/util.py.orig -+++ cloudinit/util.py -@@ -1146,7 +1146,7 @@ def chownbyname(fname, user=None, group= - # this returns the specific 'mode' entry, cleanly formatted, with value - def get_output_cfg(cfg, mode): - ret = [None, None] -- if cfg or 'output' not in cfg: -+ if not cfg or 'output' not in cfg: - return ret - - outcfg = cfg['output'] diff --git a/setupSUSEsysVInit.diff b/setupSUSEsysVInit.diff index b6bd32e..702e247 100644 --- a/setupSUSEsysVInit.diff +++ b/setupSUSEsysVInit.diff @@ -1,20 +1,18 @@ -Index: cloud-init-0.7.6/setup.py -=================================================================== ---- cloud-init-0.7.6.orig/setup.py -+++ cloud-init-0.7.6/setup.py -@@ -65,6 +65,7 @@ INITSYS_FILES = { - 'sysvinit': [f for f in glob('sysvinit/redhat/*') if is_f(f)], +--- setup.py.orig ++++ setup.py +@@ -75,6 +75,7 @@ INITSYS_FILES = { 'sysvinit_freebsd': [f for f in glob('sysvinit/freebsd/*') if is_f(f)], 'sysvinit_deb': [f for f in glob('sysvinit/debian/*') if is_f(f)], + 'sysvinit_openrc': [f for f in glob('sysvinit/gentoo/*') if is_f(f)], + 'sysvinit_suse': [f for f in glob('sysvinit/suse/*') if is_f(f)], - 'systemd': [f for f in glob('systemd/*') if is_f(f)], - 'upstart': [f for f in glob('upstart/*') if is_f(f)], - } -@@ -72,6 +73,7 @@ INITSYS_ROOTS = { - 'sysvinit': '/etc/rc.d/init.d', + 'systemd': [f for f in (glob('systemd/*.service') + + glob('systemd/*.target')) if is_f(f)], + 'systemd.generators': [f for f in glob('systemd/*-generator') if is_f(f)], +@@ -85,6 +86,7 @@ INITSYS_ROOTS = { 'sysvinit_freebsd': '/usr/local/etc/rc.d', 'sysvinit_deb': '/etc/init.d', + 'sysvinit_openrc': '/etc/init.d', + 'sysvinit_suse': '/etc/init.d', - 'systemd': systemd_unitdir(), - 'upstart': '/etc/init/', - } + 'systemd': pkg_config_read('systemd', 'systemdsystemunitdir'), + 'systemd.generators': pkg_config_read('systemd', + 'systemdsystemgeneratordir'), diff --git a/suseIntegratedHandler.patch b/suseIntegratedHandler.patch index 2acbeac..3f6112d 100644 --- a/suseIntegratedHandler.patch +++ b/suseIntegratedHandler.patch @@ -1,6 +1,6 @@ --- /dev/null +++ cloudinit/distros/opensuse.py -@@ -0,0 +1,223 @@ +@@ -0,0 +1,212 @@ +# vi: ts=4 expandtab +# +# Copyright (C) 2014 SUSE LLC @@ -152,11 +152,6 @@ + host_fn = self.hostname_conf_fn + return (host_fn, self._read_hostname(host_fn)) + -+ def _select_hostname(self, hostname, fqdn): -+ if fqdn: -+ return fqdn -+ return hostname -+ + def _write_hostname(self, hostname, out_fn): + if self.systemdDist: + util.subp(['hostnamectl', 'set-hostname', str(hostname)]) @@ -171,7 +166,7 @@ + if not conf: + conf = HostnameConf('') + conf.set_hostname(hostname) -+ util.write_file(out_fn, str(conf), 0644) ++ util.write_file(out_fn, str(conf), 0o644) + + def _write_network(self, settings): + # Convert debian settings to ifcfg format @@ -182,7 +177,7 @@ + nameservers = [] + searchservers = [] + dev_names = entries.keys() -+ for (dev, info) in entries.iteritems(): ++ for (dev, info) in entries.items(): + net_fn = self.network_script_tpl % (dev) + route_fn = self.route_conf_tpl % (dev) + mode = None @@ -218,28 +213,22 @@ + rhutil.update_resolve_conf_file(self.resolve_conf_fn, + nameservers, searchservers) + return dev_names -+ -+ -+ -+ -+ -+ --- cloudinit/distros/sles.py.orig +++ cloudinit/distros/sles.py -@@ -1,10 +1,8 @@ +@@ -1,10 +1,9 @@ # vi: ts=4 expandtab # -# Copyright (C) 2013 Hewlett-Packard Development Company, L.P. +-# +-# Author: Juerg Haefliger +# Copyright (C) 2014 SUSE LLC # --# Author: Juerg Haefliger --# --# Leaning very heavily on the RHEL and Debian implementation + # Leaning very heavily on the RHEL and Debian implementation +# Author: Robert Schweikert # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3, as -@@ -18,169 +16,11 @@ +@@ -18,162 +17,12 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . @@ -258,7 +247,9 @@ LOG = logging.getLogger(__name__) -- ++class Distro(opensuse.Distro): ++ pass + -class Distro(distros.Distro): - clock_conf_fn = '/etc/sysconfig/clock' - locale_conf_fn = '/etc/sysconfig/language' @@ -288,7 +279,7 @@ - nameservers = [] - searchservers = [] - dev_names = entries.keys() -- for (dev, info) in entries.iteritems(): +- for (dev, info) in entries.items(): - net_fn = self.network_script_tpl % (dev) - mode = info.get('auto') - if mode and mode.lower() == 'true': @@ -339,14 +330,7 @@ - if not conf: - conf = HostnameConf('') - conf.set_hostname(hostname) -- util.write_file(out_fn, str(conf), 0644) -- -- def _select_hostname(self, hostname, fqdn): -- # Prefer the short hostname over the long -- # fully qualified domain name -- if not hostname: -- return fqdn -- return hostname +- util.write_file(out_fn, str(conf), 0o644) - - def _read_system_hostname(self): - host_fn = self.hostname_conf_fn @@ -410,5 +394,3 @@ - def update_package_sources(self): - self._runner.run("update-sources", self.package_command, - ['refresh'], freq=PER_INSTANCE) -+class Distro(opensuse.Distro): -+ pass