diff -Nru cloud-init-0.7.5/debian/changelog cloud-init-0.7.5/debian/changelog --- cloud-init-0.7.5/debian/changelog 2014-04-01 12:39:05.000000000 -0600 +++ cloud-init-0.7.5/debian/changelog 2014-06-18 15:51:19.000000000 -0600 @@ -1,3 +1,12 @@ +cloud-init (0.7.5-0ubuntu1.1) trusty; urgency=medium + + * debian/patches/lp1316475-1303986-cloudsigma.patch: Backport of + CloudSigma Datasource from 14.10 + - [FFe] Support VendorData for CloudSigma (LP: #1303986). + - Only query /dev/ttys1 when CloudSigma is detected (LP: #1316475). + + -- Ben Howard Wed, 18 Jun 2014 15:49:13 -0600 + cloud-init (0.7.5-0ubuntu1) trusty; urgency=medium * New upstream release. diff -Nru cloud-init-0.7.5/debian/patches/lp1316475-1303986-cloudsigma.patch cloud-init-0.7.5/debian/patches/lp1316475-1303986-cloudsigma.patch --- cloud-init-0.7.5/debian/patches/lp1316475-1303986-cloudsigma.patch 1969-12-31 17:00:00.000000000 -0700 +++ cloud-init-0.7.5/debian/patches/lp1316475-1303986-cloudsigma.patch 2014-06-18 15:47:25.000000000 -0600 @@ -0,0 +1,114 @@ +--- a/cloudinit/sources/DataSourceCloudSigma.py ++++ b/cloudinit/sources/DataSourceCloudSigma.py +@@ -16,10 +16,12 @@ + # You should have received a copy of the GNU General Public License + # along with this program. If not, see . + from base64 import b64decode ++import os + import re + + from cloudinit import log as logging + from cloudinit import sources ++from cloudinit import util + from cloudinit.cs_utils import Cepko + + LOG = logging.getLogger(__name__) +@@ -40,12 +42,40 @@ + self.ssh_public_key = '' + sources.DataSource.__init__(self, sys_cfg, distro, paths) + ++ def is_running_in_cloudsigma(self): ++ """ ++ Uses dmidecode to detect if this instance of cloud-init is running ++ in the CloudSigma's infrastructure. ++ """ ++ uname_arch = os.uname()[4] ++ if uname_arch.startswith("arm") or uname_arch == "aarch64": ++ # Disabling because dmidecode in CMD_DMI_SYSTEM crashes kvm process ++ LOG.debug("Disabling CloudSigma datasource on arm (LP: #1243287)") ++ return False ++ ++ dmidecode_path = util.which('dmidecode') ++ if not dmidecode_path: ++ return False ++ ++ LOG.debug("Determining hypervisor product name via dmidecode") ++ try: ++ cmd = [dmidecode_path, "--string", "system-product-name"] ++ system_product_name, _ = util.subp(cmd) ++ return 'cloudsigma' in system_product_name.lower() ++ except: ++ LOG.warn("Failed to get hypervisor product name via dmidecode") ++ ++ return False ++ + def get_data(self): + """ + Metadata is the whole server context and /meta/cloud-config is used + as userdata. + """ + dsmode = None ++ if not self.is_running_in_cloudsigma(): ++ return False ++ + try: + server_context = self.cepko.all().result + server_meta = server_context['meta'] +@@ -66,6 +96,8 @@ + self.userdata_raw = server_meta.get('cloudinit-user-data', "") + if 'cloudinit-user-data' in base64_fields: + self.userdata_raw = b64decode(self.userdata_raw) ++ if 'cloudinit' in server_context.get('vendor_data', {}): ++ self.vendordata_raw = server_context["vendor_data"]["cloudinit"] + + self.metadata = server_context + self.ssh_public_key = server_meta['ssh_public_key'] +--- a/tests/unittests/test_datasource/test_cloudsigma.py ++++ b/tests/unittests/test_datasource/test_cloudsigma.py +@@ -20,7 +20,11 @@ + "smp": 1, + "tags": ["much server", "very performance"], + "uuid": "65b2fb23-8c03-4187-a3ba-8b7c919e8890", +- "vnc_password": "9e84d6cb49e46379" ++ "vnc_password": "9e84d6cb49e46379", ++ "vendor_data": { ++ "location": "zrh", ++ "cloudinit": "#cloud-config\n\n...", ++ } + } + + +@@ -35,6 +39,7 @@ + class DataSourceCloudSigmaTest(TestCase): + def setUp(self): + self.datasource = DataSourceCloudSigma.DataSourceCloudSigma("", "", "") ++ self.datasource.is_running_in_cloudsigma = lambda: True + self.datasource.cepko = CepkoMock(SERVER_CONTEXT) + self.datasource.get_data() + +@@ -68,3 +73,25 @@ + self.datasource.get_data() + + self.assertEqual(self.datasource.userdata_raw, b'hi world\n') ++ ++ def test_vendor_data(self): ++ self.assertEqual(self.datasource.vendordata_raw, ++ SERVER_CONTEXT['vendor_data']['cloudinit']) ++ ++ def test_lack_of_vendor_data(self): ++ stripped_context = copy.deepcopy(SERVER_CONTEXT) ++ del stripped_context["vendor_data"] ++ self.datasource = DataSourceCloudSigma.DataSourceCloudSigma("", "", "") ++ self.datasource.cepko = CepkoMock(stripped_context) ++ self.datasource.get_data() ++ ++ self.assertIsNone(self.datasource.vendordata_raw) ++ ++ def test_lack_of_cloudinit_key_in_vendor_data(self): ++ stripped_context = copy.deepcopy(SERVER_CONTEXT) ++ del stripped_context["vendor_data"]["cloudinit"] ++ self.datasource = DataSourceCloudSigma.DataSourceCloudSigma("", "", "") ++ self.datasource.cepko = CepkoMock(stripped_context) ++ self.datasource.get_data() ++ ++ self.assertIsNone(self.datasource.vendordata_raw) diff -Nru cloud-init-0.7.5/debian/patches/series cloud-init-0.7.5/debian/patches/series --- cloud-init-0.7.5/debian/patches/series 1969-12-31 17:00:00.000000000 -0700 +++ cloud-init-0.7.5/debian/patches/series 2014-06-18 15:46:25.000000000 -0600 @@ -0,0 +1 @@ +lp1316475-1303986-cloudsigma.patch