From 2f5d8a6a7792d742ef905a6570442ce2f272487899d6836faca486ccee57166d Mon Sep 17 00:00:00 2001 From: Robert Schweikert Date: Mon, 17 Mar 2014 17:58:53 +0000 Subject: [PATCH 1/6] - add dependency n growpart to aupport root partition expansion OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=6 --- cloud-init.changes | 5 +++++ cloud-init.spec | 1 + 2 files changed, 6 insertions(+) diff --git a/cloud-init.changes b/cloud-init.changes index acaefde..3374996 100644 --- a/cloud-init.changes +++ b/cloud-init.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Mar 17 17:58:23 UTC 2014 - rschweikert@suse.com + +- add dependency n growpart to aupport root partition expansion + ------------------------------------------------------------------- Mon Jan 20 17:51:24 UTC 2014 - dmueller@suse.com diff --git a/cloud-init.spec b/cloud-init.spec index 3236d3d..58a78ea 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -32,6 +32,7 @@ BuildRequires: fdupes BuildRequires: filesystem BuildRequires: python-devel BuildRequires: python-setuptools +Requires: growpart Requires: python-argparse Requires: python-boto >= 2.7 Requires: python-cheetah From b363ee209596e7ae826fd0532cd90c6c790db063dbda9fdf54bd87d4b6ac9aaa Mon Sep 17 00:00:00 2001 From: Robert Schweikert Date: Mon, 17 Mar 2014 18:40:51 +0000 Subject: [PATCH 2/6] - include in SLE 12 (FATE #315990, #315991, and 316167) - add patch azure_1269626.diff, fix for upstream bug 1269626 + Azure instance do not boot properly after a capture operation OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=7 --- azure_1269626.diff | 87 ++++++++++++++++++++++++++++++++++++++++++++++ cloud-init.changes | 7 ++++ cloud-init.spec | 2 ++ 3 files changed, 96 insertions(+) create mode 100644 azure_1269626.diff diff --git a/azure_1269626.diff b/azure_1269626.diff new file mode 100644 index 0000000..82c1ece --- /dev/null +++ b/azure_1269626.diff @@ -0,0 +1,87 @@ +=== modified file 'cloudinit/sources/DataSourceAzure.py' +--- cloudinit/sources/DataSourceAzure.py 2014-01-09 18:12:40 +0000 ++++ cloudinit/sources/DataSourceAzure.py 2014-02-07 11:51:56 +0000 +@@ -84,9 +84,14 @@ + + candidates = [self.seed_dir] + candidates.extend(list_possible_azure_ds_devs()) ++ previous_ovf_cfg = None + if ddir: + candidates.append(ddir) + ++ previous_ovf_cfg = None ++ if os.path.exists("%s/ovf-env.xml" % ddir): ++ previous_ovf_cfg = load_azure_ds_dir(ddir) ++ + found = None + + for cdev in candidates: +@@ -104,6 +109,11 @@ + LOG.warn("%s was not mountable" % cdev) + continue + ++ if ret != previous_ovf_cfg: ++ LOG.info(("instance configuration has changed, " ++ "removing old agent directory")) ++ util.del_dir(ddir) ++ + (md, self.userdata_raw, cfg, files) = ret + self.seed = cdev + self.metadata = util.mergemanydict([md, DEFAULT_METADATA]) + +=== modified file 'tests/unittests/test_datasource/test_azure.py' +--- tests/unittests/test_datasource/test_azure.py 2013-10-02 21:05:15 +0000 ++++ tests/unittests/test_datasource/test_azure.py 2014-02-07 11:51:56 +0000 +@@ -119,6 +119,10 @@ + {'ovf-env.xml': data['ovfcontent']}) + + mod = DataSourceAzure ++ ddir = "%s/var/lib/waagent" % self.tmp ++ mod.BUILTIN_DS_CONFIG['data_dir'] = ddir ++ if not os.path.isdir(ddir): ++ os.makedirs(ddir) + + self.apply_patches([(mod, 'list_possible_azure_ds_devs', dsdevs)]) + +@@ -338,6 +342,40 @@ + + self.assertEqual(userdata, dsrc.userdata_raw) + ++ def test_existing_ovf_same(self): ++ mydata = "FOOBAR" ++ odata = {'UserData': base64.b64encode(mydata)} ++ data = {'ovfcontent': construct_valid_ovf_env(data=odata)} ++ ++ with open("%s/ovf-env.xml" % self.tmp, 'w') as fp: ++ fp.write(construct_valid_ovf_env(data=odata)) ++ with open("%s/sem" % self.tmp, 'w') as fp: ++ fp.write("test") ++ ++ dsrc = self._get_ds(data) ++ ret = dsrc.get_data() ++ self.assertTrue(ret) ++ self.assertEqual(dsrc.userdata_raw, mydata) ++ self.assertTrue(os.path.exists("%s/sem" % self.tmp)) ++ ++ def test_existing_ovf_diff(self): ++ mydata = "FOOBAR" ++ odata = {'UserData': base64.b64encode(mydata)} ++ data = {'ovfcontent': construct_valid_ovf_env(data=odata)} ++ ++ data_dir = "%s/var/lib/waagent" % self.tmp ++ os.makedirs(data_dir) ++ with open("%s/ovf-env.xml" % data_dir, 'w') as fp: ++ fp.write(construct_valid_ovf_env()) ++ with open("%s/sem" % data_dir, 'w') as fp: ++ fp.write("test") ++ ++ dsrc = self._get_ds(data) ++ ret = dsrc.get_data() ++ self.assertTrue(ret) ++ self.assertEqual(dsrc.userdata_raw, mydata) ++ self.assertFalse(os.path.exists("%s/sem" % data_dir)) ++ + + class TestReadAzureOvf(MockerTestCase): + def test_invalid_xml_raises_non_azure_ds(self): + diff --git a/cloud-init.changes b/cloud-init.changes index 3374996..da03a4a 100644 --- a/cloud-init.changes +++ b/cloud-init.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Mar 17 18:37:58 UTC 2014 - rschweikert@suse.com + +- include in SLE 12 (FATE #315990, #315991, and 316167) +- add patch azure_1269626.diff, fix for upstream bug 1269626 + + Azure instance do not boot properly after a capture operation + ------------------------------------------------------------------- Mon Mar 17 17:58:23 UTC 2014 - rschweikert@suse.com diff --git a/cloud-init.spec b/cloud-init.spec index 58a78ea..730d498 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -28,6 +28,7 @@ Patch0: suseSysVInit.diff Patch1: addopenSUSEBase.diff Patch2: openSUSEHandler.diff Patch3: setupSUSEsysVInit.diff +Patch4: azure_1269626.diff BuildRequires: fdupes BuildRequires: filesystem BuildRequires: python-devel @@ -96,6 +97,7 @@ Unit tests for the cloud-init tools %patch1 -p1 %patch2 -p1 %patch3 -p1 +%patch4 %if 0%{?suse_version} <= 1130 # disable ecdsa for SLE 11 (not available) echo "ssh_genkeytypes: ['rsa', 'dsa']" >> %{SOURCE1} From 7582cf4365ae5d49a66c6acb70e62d42a60d4c97abac8c6bdb4a091d854e64fa Mon Sep 17 00:00:00 2001 From: Robert Schweikert Date: Tue, 18 Mar 2014 19:43:58 +0000 Subject: [PATCH 3/6] - include the LICENSE - add dependency on growpart to aupport root partition expansion OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=8 --- cloud-init.changes | 7 ++++++- cloud-init.spec | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/cloud-init.changes b/cloud-init.changes index da03a4a..de9d920 100644 --- a/cloud-init.changes +++ b/cloud-init.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Mar 18 15:01:51 UTC 2014 - rschweikert@suse.com + +- include the LICENSE + ------------------------------------------------------------------- Mon Mar 17 18:37:58 UTC 2014 - rschweikert@suse.com @@ -8,7 +13,7 @@ Mon Mar 17 18:37:58 UTC 2014 - rschweikert@suse.com ------------------------------------------------------------------- Mon Mar 17 17:58:23 UTC 2014 - rschweikert@suse.com -- add dependency n growpart to aupport root partition expansion +- add dependency on growpart to aupport root partition expansion ------------------------------------------------------------------- Mon Jan 20 17:51:24 UTC 2014 - dmueller@suse.com diff --git a/cloud-init.spec b/cloud-init.spec index 730d498..b7f525d 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -120,15 +120,23 @@ mkdir -p %{buildroot}%{_localstatedir}/lib/cloud mkdir -p %{buildroot}%{_defaultdocdir} mv %{buildroot}%{_datadir}/doc/%{name} %{buildroot}%{docdir} cp -a %{SOURCE1} %{buildroot}/%{_sysconfdir}/cloud/cloud.cfg +# copy the LICENSE +cp LICENSE %{buildroot}%{docdir} # Set the distribution indicator %if 0%{?suse_version} %if 0%{?suse_version} < 1130 +#SLE 11, openSUSE 11.x is EOL sed -i s/INSERT_SUSE_DISTRO/sles/ %{buildroot}/%{_sysconfdir}/cloud/cloud.cfg %endif %if 0%{?suse_version} > 1140 +%if 0%{?suse_version} == 1315 +# SLE 12 +sed -i s/INSERT_SUSE_DISTRO/sles/ %{buildroot}/%{_sysconfdir}/cloud/cloud.cfg +%else sed -i s/INSERT_SUSE_DISTRO/opensuse/ %{buildroot}/%{_sysconfdir}/cloud/cloud.cfg %endif %endif +%endif # remove debian/ubuntu specific profile.d file (bnc#779553) rm -f %{buildroot}%{_sysconfdir}/profile.d/Z99-cloud-locale-test.sh @@ -154,6 +162,8 @@ popd %files %defattr(-,root,root) +# do not mark as doc or we get conflicts with the doc package +%{docdir}/LICENSE %{_bindir}/cloud-init %{_bindir}/cloud-init-per %config(noreplace) %{_sysconfdir}/cloud/ @@ -177,10 +187,15 @@ popd %{systemd_prefix}/systemd/system/cloud-final.service %endif %dir %attr(0755, root, root) %{_localstatedir}/lib/cloud +%dir %{docdir} %files doc %defattr(-,root,root) -%doc %{docdir} +%{docdir}/examples/* +%{docdir}/README +%{docdir}/*.txt +%{docdir}/*.rst +%dir %{docdir}/examples %files test %defattr(-,root,root) From 9066aef71023911da72dada26071b8a3d4daa4036cfd10a8c7f6313eea3d800c Mon Sep 17 00:00:00 2001 From: Robert Schweikert Date: Wed, 19 Mar 2014 21:08:48 +0000 Subject: [PATCH 4/6] - enable growing of root partition by default bnc#861473 - add dependency on growpart to support root partition expansion OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=9 --- cloud-init.changes | 7 ++++++- cloud.cfg.suse | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cloud-init.changes b/cloud-init.changes index de9d920..31aef05 100644 --- a/cloud-init.changes +++ b/cloud-init.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Mar 19 20:49:32 UTC 2014 - rschweikert@suse.com + +- enable growing of root partition by default bnc#861473 + ------------------------------------------------------------------- Tue Mar 18 15:01:51 UTC 2014 - rschweikert@suse.com @@ -13,7 +18,7 @@ Mon Mar 17 18:37:58 UTC 2014 - rschweikert@suse.com ------------------------------------------------------------------- Mon Mar 17 17:58:23 UTC 2014 - rschweikert@suse.com -- add dependency on growpart to aupport root partition expansion +- add dependency on growpart to support root partition expansion ------------------------------------------------------------------- Mon Jan 20 17:51:24 UTC 2014 - dmueller@suse.com diff --git a/cloud.cfg.suse b/cloud.cfg.suse index fec2483..a37c69e 100644 --- a/cloud.cfg.suse +++ b/cloud.cfg.suse @@ -13,6 +13,7 @@ cloud_init_modules: - migrator - bootcmd - write-files + - gowpart - resizefs - set_hostname - update_hostname From 56a9174e6fdc0eff913562cad7d4f8c5b283a3b935946b4e301845693eee2981 Mon Sep 17 00:00:00 2001 From: Robert Schweikert Date: Wed, 19 Mar 2014 21:38:02 +0000 Subject: [PATCH 5/6] - do not package any none SUSE/openSUSE templates bnc#839707 - add patch openSUSEhostsTemplate.diff to add an openSUSE hosts template OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=10 --- cloud-init.changes | 6 ++++++ cloud-init.spec | 8 ++++++++ openSUSEhostsTemplate.diff | 29 +++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 openSUSEhostsTemplate.diff diff --git a/cloud-init.changes b/cloud-init.changes index 31aef05..2f79618 100644 --- a/cloud-init.changes +++ b/cloud-init.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Mar 19 21:36:19 UTC 2014 - rschweikert@suse.com + +- do not package any none SUSE/openSUSE templates bnc#839707 +- add patch openSUSEhostsTemplate.diff to add an openSUSE hosts template + ------------------------------------------------------------------- Wed Mar 19 20:49:32 UTC 2014 - rschweikert@suse.com diff --git a/cloud-init.spec b/cloud-init.spec index b7f525d..419da4d 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -29,6 +29,7 @@ Patch1: addopenSUSEBase.diff Patch2: openSUSEHandler.diff Patch3: setupSUSEsysVInit.diff Patch4: azure_1269626.diff +Patch5: openSUSEhostsTemplate.diff BuildRequires: fdupes BuildRequires: filesystem BuildRequires: python-devel @@ -98,6 +99,8 @@ Unit tests for the cloud-init tools %patch2 -p1 %patch3 -p1 %patch4 +%patch5 + %if 0%{?suse_version} <= 1130 # disable ecdsa for SLE 11 (not available) echo "ssh_genkeytypes: ['rsa', 'dsa']" >> %{SOURCE1} @@ -141,6 +144,11 @@ sed -i s/INSERT_SUSE_DISTRO/opensuse/ %{buildroot}/%{_sysconfdir}/cloud/cloud.cf # remove debian/ubuntu specific profile.d file (bnc#779553) rm -f %{buildroot}%{_sysconfdir}/profile.d/Z99-cloud-locale-test.sh +# Remove non-SUSE templates +rm %{buildroot}/%{_sysconfdir}/cloud/templates/*.debian.* +rm %{buildroot}/%{_sysconfdir}/cloud/templates/*.redhat.* +rm %{buildroot}/%{_sysconfdir}/cloud/templates/*.ubuntu.* + # move sysvinit scripts into the "right" place %if 0%{?suse_version} && 0%{?suse_version} <= 1210 mkdir -p %{buildroot}/%{_initddir} diff --git a/openSUSEhostsTemplate.diff b/openSUSEhostsTemplate.diff new file mode 100644 index 0000000..4d75e86 --- /dev/null +++ b/openSUSEhostsTemplate.diff @@ -0,0 +1,29 @@ +--- /dev/null ++++ templates/hosts.opensuse.tmpl +@@ -0,0 +1,26 @@ ++* ++ This file /etc/cloud/templates/hosts.opensuse.tmpl is only utilized ++ if enabled in cloud-config. Specifically, in order to enable it ++ you need to add the following to config: ++ manage_etc_hosts: True ++*# ++# Your system has configured 'manage_etc_hosts' as True. ++# As a result, if you wish for changes to this file to persist ++# then you will need to either ++# a.) make changes to the master file in ++# /etc/cloud/templates/hosts.opensuse.tmpl ++# b.) change or remove the value of 'manage_etc_hosts' in ++# /etc/cloud/cloud.cfg or cloud-config from user-data ++# ++# The following lines are desirable for IPv4 capable hosts ++127.0.0.1 localhost ++ ++# The following lines are desirable for IPv6 capable hosts ++::1 localhost ipv6-localhost ipv6-loopback ++fe00::0 ipv6-localnet ++ ++ff00::0 ipv6-mcastprefix ++ff02::1 ipv6-allnodes ++ff02::2 ipv6-allrouters ++ff02::3 ipv6-allhosts ++ From 613771aca90ddcb01a565ca149aded5647a2386eb40f7ddf7594cd10417d59c3 Mon Sep 17 00:00:00 2001 From: Robert Schweikert Date: Sat, 29 Mar 2014 21:40:50 +0000 Subject: [PATCH 6/6] - fix implementation of the openSUSE handler, properly read the configuration from sysconfig OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=11 --- cloud-init.changes | 6 ++++++ openSUSEHandler.diff | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/cloud-init.changes b/cloud-init.changes index 2f79618..c6da03f 100644 --- a/cloud-init.changes +++ b/cloud-init.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Sat Mar 29 21:40:00 UTC 2014 - rschweikert@suse.com + +- fix implementation of the openSUSE handler, properly read the configuration + from sysconfig + ------------------------------------------------------------------- Wed Mar 19 21:36:19 UTC 2014 - rschweikert@suse.com diff --git a/openSUSEHandler.diff b/openSUSEHandler.diff index 84d51f1..9966cec 100644 --- a/openSUSEHandler.diff +++ b/openSUSEHandler.diff @@ -1,7 +1,7 @@ diff -urN cloud-init-0.7.4/cloudinit/distros/opensuse.py cloud-init-0.7.4.os/cloudinit/distros/opensuse.py --- cloud-init-0.7.4/cloudinit/distros/opensuse.py 1969-12-31 19:00:00.000000000 -0500 +++ cloud-init-0.7.4.os/cloudinit/distros/opensuse.py 2013-06-15 06:26:15.312348359 -0400 -@@ -0,0 +1,86 @@ +@@ -0,0 +1,87 @@ +# vi: ts=4 expandtab +# +# Copyright (C) 2013 SUSE LLC @@ -25,6 +25,7 @@ diff -urN cloud-init-0.7.4/cloudinit/distros/opensuse.py cloud-init-0.7.4.os/clo +import os + +from cloudinit.distros import sles ++from cloudinit.distros import rhel_util + +from cloudinit.distros.parsers.resolv_conf import ResolvConf +from cloudinit.distros.parsers.sys_conf import SysConf @@ -81,7 +82,7 @@ diff -urN cloud-init-0.7.4/cloudinit/distros/opensuse.py cloud-init-0.7.4.os/clo + if len(out): + return out + else: -+ (_exists, contents) = self._read_conf(filename) ++ (_exists, contents) = rhel_util.read_sysconfig_file(filename) + if 'HOSTNAME' in contents: + return contents['HOSTNAME'] + else: