summaryrefslogtreecommitdiff
path: root/debian/patches
diff options
context:
space:
mode:
authorScott Moser <smoser@brickies.net>2016-12-13 09:30:45 -0500
committerScott Moser <smoser@brickies.net>2016-12-13 09:30:45 -0500
commitf3cbd22ed83eac85c0cccd46a49dd413f3638453 (patch)
treec40569f0d6cb972bd684afce9dbd3a1f981df4ed /debian/patches
parent05b2b885e803eea3701ccfa0a5544e46ef5836ff (diff)
downloadvyos-cloud-init-f3cbd22ed83eac85c0cccd46a49dd413f3638453.tar.gz
vyos-cloud-init-f3cbd22ed83eac85c0cccd46a49dd413f3638453.zip
cherry pick a9d41de
LP: #1648380
Diffstat (limited to 'debian/patches')
-rw-r--r--debian/patches/cpick-a9d41de-CloudSigma-Fix-bug-where-datasource-was-not-loaded-in133
-rw-r--r--debian/patches/series1
2 files changed, 134 insertions, 0 deletions
diff --git a/debian/patches/cpick-a9d41de-CloudSigma-Fix-bug-where-datasource-was-not-loaded-in b/debian/patches/cpick-a9d41de-CloudSigma-Fix-bug-where-datasource-was-not-loaded-in
new file mode 100644
index 00000000..b886853c
--- /dev/null
+++ b/debian/patches/cpick-a9d41de-CloudSigma-Fix-bug-where-datasource-was-not-loaded-in
@@ -0,0 +1,133 @@
+From a9d41de47a58d967ae3fd6a7749f8143a14424d3 Mon Sep 17 00:00:00 2001
+From: Scott Moser <smoser@ubuntu.com>
+Date: Wed, 7 Dec 2016 19:17:03 +0100
+Subject: [PATCH] CloudSigma: Fix bug where datasource was not loaded in local
+ search.
+
+CloudSigma would not get any datasources loaded during cloud-init local.
+Thus, when the network datasource was removed, *no* CloudSigma
+datasources would be loaded.
+
+LP: #1648380
+---
+ cloudinit/sources/DataSourceCloudSigma.py | 2 +-
+ tests/unittests/test_datasource/test_cloudsigma.py | 15 +++++
+ tests/unittests/test_datasource/test_common.py | 73 ++++++++++++++++++++++
+ 3 files changed, 89 insertions(+), 1 deletion(-)
+ create mode 100644 tests/unittests/test_datasource/test_common.py
+
+--- a/cloudinit/sources/DataSourceCloudSigma.py
++++ b/cloudinit/sources/DataSourceCloudSigma.py
+@@ -115,7 +115,7 @@ DataSourceCloudSigmaNet = DataSourceClou
+ # Used to match classes to dependencies. Since this datasource uses the serial
+ # port network is not really required, so it's okay to load without it, too.
+ datasources = [
+- (DataSourceCloudSigma, (sources.DEP_FILESYSTEM)),
++ (DataSourceCloudSigma, (sources.DEP_FILESYSTEM, )),
+ ]
+
+
+--- a/tests/unittests/test_datasource/test_cloudsigma.py
++++ b/tests/unittests/test_datasource/test_cloudsigma.py
+@@ -3,6 +3,7 @@
+ import copy
+
+ from cloudinit.cs_utils import Cepko
++from cloudinit import sources
+ from cloudinit.sources import DataSourceCloudSigma
+
+ from .. import helpers as test_helpers
+@@ -97,3 +98,17 @@ class DataSourceCloudSigmaTest(test_help
+ self.datasource.get_data()
+
+ self.assertIsNone(self.datasource.vendordata_raw)
++
++
++class DsLoads(test_helpers.TestCase):
++ def test_get_datasource_list_returns_in_local(self):
++ deps = (sources.DEP_FILESYSTEM,)
++ ds_list = DataSourceCloudSigma.get_datasource_list(deps)
++ self.assertEqual(ds_list,
++ [DataSourceCloudSigma.DataSourceCloudSigma])
++
++ def test_list_sources_finds_ds(self):
++ found = sources.list_sources(
++ ['CloudSigma'], (sources.DEP_FILESYSTEM,), ['cloudinit.sources'])
++ self.assertEqual([DataSourceCloudSigma.DataSourceCloudSigma],
++ found)
+--- /dev/null
++++ b/tests/unittests/test_datasource/test_common.py
+@@ -0,0 +1,73 @@
++from cloudinit import settings
++from cloudinit import sources
++from cloudinit import type_utils
++from cloudinit.sources import (
++ DataSourceAliYun as AliYun,
++ DataSourceAltCloud as AltCloud,
++ DataSourceAzure as Azure,
++ DataSourceBigstep as Bigstep,
++ DataSourceCloudSigma as CloudSigma,
++ DataSourceCloudStack as CloudStack,
++ DataSourceConfigDrive as ConfigDrive,
++ DataSourceDigitalOcean as DigitalOcean,
++ DataSourceEc2 as Ec2,
++ DataSourceGCE as GCE,
++ DataSourceMAAS as MAAS,
++ DataSourceNoCloud as NoCloud,
++ DataSourceOpenNebula as OpenNebula,
++ DataSourceOpenStack as OpenStack,
++ DataSourceOVF as OVF,
++ DataSourceSmartOS as SmartOS,
++)
++from cloudinit.sources import DataSourceNone as DSNone
++
++from .. import helpers as test_helpers
++
++DEFAULT_LOCAL = [
++ CloudSigma.DataSourceCloudSigma,
++ ConfigDrive.DataSourceConfigDrive,
++ DigitalOcean.DataSourceDigitalOcean,
++ NoCloud.DataSourceNoCloud,
++ OpenNebula.DataSourceOpenNebula,
++ OVF.DataSourceOVF,
++ SmartOS.DataSourceSmartOS,
++]
++
++DEFAULT_NETWORK = [
++ AltCloud.DataSourceAltCloud,
++ Azure.DataSourceAzureNet,
++ Bigstep.DataSourceBigstep,
++ CloudStack.DataSourceCloudStack,
++ DSNone.DataSourceNone,
++ Ec2.DataSourceEc2,
++ GCE.DataSourceGCE,
++ MAAS.DataSourceMAAS,
++ NoCloud.DataSourceNoCloudNet,
++ OpenStack.DataSourceOpenStack,
++ OVF.DataSourceOVFNet,
++]
++
++
++class ExpectedDataSources(test_helpers.TestCase):
++ builtin_list = settings.CFG_BUILTIN['datasource_list']
++ deps_local = [sources.DEP_FILESYSTEM]
++ deps_network = [sources.DEP_FILESYSTEM, sources.DEP_NETWORK]
++ pkg_list = [type_utils.obj_name(sources)]
++
++ def test_expected_default_local_sources_found(self):
++ found = sources.list_sources(
++ self.builtin_list, self.deps_local, self.pkg_list)
++ self.assertEqual(set(DEFAULT_LOCAL), set(found))
++
++ def test_expected_default_network_sources_found(self):
++ found = sources.list_sources(
++ self.builtin_list, self.deps_network, self.pkg_list)
++ self.assertEqual(set(DEFAULT_NETWORK), set(found))
++
++ def test_expected_nondefault_network_sources_found(self):
++ found = sources.list_sources(
++ ['AliYun'], self.deps_network, self.pkg_list)
++ self.assertEqual(set([AliYun.DataSourceAliYun]), set(found))
++
++
++# vi: ts=4 expandtab
diff --git a/debian/patches/series b/debian/patches/series
index 4e1ef425..d303ed06 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@ cpick-18203bf-disk_setup-Use-sectors-as-unit-when-formatting-MBR-disks
cpick-6e92c5f-net-cmdline-Consider-ip-or-ip6-on-command-line-not-only
cpick-8c6878a-tests-fix-assumptions-that-expected-no-eth0-in-system
cpick-2d2ec70-OpenStack-extend-physical-types-to-include-hyperv-hw_veb
+cpick-a9d41de-CloudSigma-Fix-bug-where-datasource-was-not-loaded-in