SHA256
1
0
forked from pool/cloud-init

Accepting request 228217 from Cloud:Tools

- fix implementation of the openSUSE handler, properly read the configuration
  from sysconfig

- do not package any none SUSE/openSUSE templates bnc#839707
- add patch openSUSEhostsTemplate.diff to add an openSUSE hosts template

- enable growing of root partition by default bnc#861473

- include the LICENSE

- 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

- add dependency on growpart to support root partition expansion

OBS-URL: https://build.opensuse.org/request/show/228217
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/cloud-init?expand=0&rev=10
This commit is contained in:
Stephan Kulow 2014-04-08 11:01:38 +00:00 committed by Git OBS Bridge
commit 6554f0e50b
6 changed files with 181 additions and 3 deletions

87
azure_1269626.diff Normal file
View File

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

View File

@ -1,3 +1,37 @@
-------------------------------------------------------------------
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
- 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
- enable growing of root partition by default bnc#861473
-------------------------------------------------------------------
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
- 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
- add dependency on growpart to support root partition expansion
-------------------------------------------------------------------
Mon Jan 20 17:51:24 UTC 2014 - dmueller@suse.com

View File

@ -28,10 +28,13 @@ Patch0: suseSysVInit.diff
Patch1: addopenSUSEBase.diff
Patch2: openSUSEHandler.diff
Patch3: setupSUSEsysVInit.diff
Patch4: azure_1269626.diff
Patch5: openSUSEhostsTemplate.diff
BuildRequires: fdupes
BuildRequires: filesystem
BuildRequires: python-devel
BuildRequires: python-setuptools
Requires: growpart
Requires: python-argparse
Requires: python-boto >= 2.7
Requires: python-cheetah
@ -95,6 +98,9 @@ Unit tests for the cloud-init tools
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4
%patch5
%if 0%{?suse_version} <= 1130
# disable ecdsa for SLE 11 (not available)
echo "ssh_genkeytypes: ['rsa', 'dsa']" >> %{SOURCE1}
@ -117,19 +123,32 @@ 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
# 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}
@ -151,6 +170,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/
@ -174,10 +195,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)

View File

@ -13,6 +13,7 @@ cloud_init_modules:
- migrator
- bootcmd
- write-files
- gowpart
- resizefs
- set_hostname
- update_hostname

View File

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

View File

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