summaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
authorKim Hagen <kim.sidney@gmail.com>2018-10-25 22:26:25 +0200
committerKim Hagen <kim.sidney@gmail.com>2018-10-25 22:26:25 +0200
commitb120f4f7a670674779a93f8c882c81f44a993888 (patch)
tree906d15f6520751b5e8fbeb49b680e673a5cc6aa3 /debian
parent838581d57c8765d3e487f58bc37ea103af39d26f (diff)
parent833adcdf6f85ec2305e62bea5a20f9363bf95507 (diff)
downloadvyos-cloud-init-b120f4f7a670674779a93f8c882c81f44a993888.tar.gz
vyos-cloud-init-b120f4f7a670674779a93f8c882c81f44a993888.zip
Merge tag 'ubuntu/18.4-0ubuntu1_16.04.2' into current
Conflicts: cloudinit/sources/DataSourceAzure.py config/cloud.cfg.tmpl integration-requirements.txt tools/read-version
Diffstat (limited to 'debian')
-rw-r--r--debian/changelog216
-rw-r--r--debian/patches/azure-apply-network-config-false.patch23
-rw-r--r--debian/patches/azure-use-walinux-agent.patch4
-rw-r--r--debian/patches/cpick-1d5e9aef-azure-Add-apply_network_config-option-to-disable228
-rw-r--r--debian/patches/ds-identify-behavior-xenial.patch4
-rw-r--r--debian/patches/openstack-no-network-config.patch40
-rw-r--r--debian/patches/series3
-rwxr-xr-xdebian/rules2
8 files changed, 516 insertions, 4 deletions
diff --git a/debian/changelog b/debian/changelog
index 7a26815b..74e8dc2d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,219 @@
+cloud-init (18.4-0ubuntu1~16.04.2) xenial; urgency=medium
+
+ * cherry-pick 1d5e9aef: azure: Add apply_network_config option to
+ disable network (LP: #1798424)
+ * debian/patches/openstack-no-network-config.patch
+ add patch to default Azure apply_network_config to False. Only
+ fallback network config on eth0 is generated by cloud-init. IMDS
+ network_config is ignored.
+
+ -- Chad Smith <chad.smith@canonical.com> Wed, 17 Oct 2018 12:51:09 -0600
+
+cloud-init (18.4-0ubuntu1~16.04.1) xenial-proposed; urgency=medium
+
+ * drop the following cherry-picks now included:
+ + cpick-3cee0bf8-oracle-fix-detect_openstack-to-report-True-on
+ * refresh patches:
+ + debian/patches/azure-use-walinux-agent.patch
+ + debian/patches/openstack-no-network-config.patch
+ * refresh patches:
+ + debian/patches/ds-identify-behavior-xenial.patch
+ * New upstream release. (LP: #1795953)
+ - release 18.4
+ - tests: allow skipping an entire cloud_test without running.
+ - tests: disable lxd tests on cosmic
+ - cii-tests: use unittest2.SkipTest in ntp_chrony due to new deps
+ - lxd: adjust to snap installed lxd.
+ - docs: surface experimental doc in instance-data.json
+ - tests: fix ec2 integration tests. process meta_data instead of meta-data
+ - Add support for Infiniband network interfaces (IPoIB). [Mark Goddard]
+ - cli: add cloud-init query subcommand to query instance metadata
+ - tools/tox-venv: update for new features.
+ - pylint: ignore warning assignment-from-no-return for _write_network
+ - stages: Fix bug causing datasource to have incorrect sys_cfg.
+ - Remove dead-code _write_network distro implementations.
+ - net_util: ensure static configs have netmask in translate_network result
+ [Thomas Berger]
+ - Fall back to root:root on syslog permissions if other options fail.
+ [Robert Schweikert]
+ - tests: Add mock for util.get_hostname. [Robert Schweikert]
+ - ds-identify: doc string cleanup.
+ - OpenStack: Support setting mac address on bond. [Fabian Wiesel]
+ - bash_completion/cloud-init: fix shell syntax error.
+ - EphemeralIPv4Network: Be more explicit when adding default route.
+ - OpenStack: support reading of newer versions of metdata.
+ - OpenStack: fix bug causing 'latest' version to be used from network.
+ - user-data: jinja template to render instance-data.json in cloud-config
+ - config: disable ssh access to a configured user account
+ - tests: print failed testname instead of docstring upon failure
+ - tests: Disallow use of util.subp except for where needed.
+ - sysconfig: refactor sysconfig to accept distro specific templates paths
+ - Add unit tests for config/cc_ssh.py [Francis Ginther]
+ - Fix the built-in cloudinit/tests/helpers:skipIf
+ - read-version: enhance error message [Joshua Powers]
+ - hyperv_reporting_handler: simplify threaded publisher
+ - VMWare: Fix a network config bug in vm with static IPv4 and no gateway.
+ [Pengpeng Sun]
+ - logging: Add logging config type hyperv for reporting via Azure KVP
+ [Andy Liu]
+ - tests: disable other snap test as well [Joshua Powers]
+ - tests: disable snap, fix write_files binary [Joshua Powers]
+ - Add datasource Oracle Compute Infrastructure (OCI).
+ - azure: allow azure to generate network configuration from IMDS per boot.
+ - Scaleway: Add network configuration to the DataSource [Louis Bouchard]
+ - docs: Fix example cloud-init analyze command to match output.
+ [Wesley Gao]
+ - netplan: Correctly render macaddress on a bonds and bridges when
+ provided.
+ - tools: Add 'net-convert' subcommand command to 'cloud-init devel'.
+ - redhat: remove ssh keys on new instance.
+ - Use typeset or local in profile.d scripts.
+ - OpenNebula: Fix null gateway6 [Akihiko Ota]
+ - oracle: fix detect_openstack to report True on OracleCloud.com DMI data
+ - tests: improve LXDInstance trying to workaround or catch bug.
+ - update_metadata re-config on every boot comments and tests not quite
+ right [Mike Gerdts]
+ - tests: Collect build_info from system if available.
+ - pylint: Fix pylint warnings reported in pylint 2.0.0.
+ - get_linux_distro: add support for rhel via redhat-release.
+ - get_linux_distro: add support for centos6 and rawhide flavors of redhat
+ - tools: add '--debug' to tools/net-convert.py
+ - tests: bump the version of paramiko to 2.4.1.
+
+ -- Chad Smith <chad.smith@canonical.com> Wed, 03 Oct 2018 12:10:25 -0600
+
+cloud-init (18.3-9-g2e62cb8a-0ubuntu1~16.04.2) xenial-proposed; urgency=medium
+
+ * cherry-pick 3cee0bf8: oracle: fix detect_openstack to report True on
+ (LP: #1784685)
+
+ -- Chad Smith <chad.smith@canonical.com> Tue, 31 Jul 2018 13:57:21 -0600
+
+cloud-init (18.3-9-g2e62cb8a-0ubuntu1~16.04.1) xenial-proposed; urgency=medium
+
+ * New upstream snapshot. (LP: #1777912)
+ - docs: note in rtd about avoiding /tmp when writing files
+ - ubuntu,centos,debian: get_linux_distro to align with platform.dist
+ - Fix boothook docs on environment variable name (INSTANCE_I ->
+ INSTANCE_ID) [Marc Tamsky]
+ - update_metadata: a datasource can support network re-config every boot
+ - tests: drop salt-minion integration test
+ - Retry on failed import of gpg receive keys.
+ - tools: Fix run-container when neither source or binary package requested.
+ - docs: Fix a small spelling error. [Oz N Tiram]
+ - tox: use simplestreams from git repository rather than bzr.
+
+ -- Chad Smith <chad.smith@canonical.com> Mon, 09 Jul 2018 15:34:52 -0600
+
+cloud-init (18.3-0ubuntu1~16.04.1) xenial-proposed; urgency=medium
+
+ * debian/rules: update version.version_string to contain packaged version.
+ (LP: #1770712)
+ * debian/patches/openstack-no-network-config.patch
+ add patch to ignore Openstack network_config from network_data.json by
+ default
+ * Refresh patches against upstream:
+ + azure-use-walinux-agent.patch
+ + ds-identify-behavior-xenial.patch
+ * New upstream release. (LP: #1777912)
+ - release 18.3
+ - docs: represent sudo:false in docs for user_groups config module
+ - Explicitly prevent `sudo` access for user module [Jacob Bednarz]
+ - lxd: Delete default network and detach device if lxd-init created them.
+ - openstack: avoid unneeded metadata probe on non-openstack platforms
+ - stages: fix tracebacks if a module stage is undefined or empty
+ [Robert Schweikert]
+ - Be more safe on string/bytes when writing multipart user-data to disk.
+ - Fix get_proc_env for pids that have non-utf8 content in environment.
+ - tests: fix salt_minion integration test on bionic and later
+ - tests: provide human-readable integration test summary when --verbose
+ - tests: skip chrony integration tests on lxd running artful or older
+ - test: add optional --preserve-instance arg to integraiton tests
+ - netplan: fix mtu if provided by network config for all rendered types
+ - tests: remove pip install workarounds for pylxd, take upstream fix.
+ - subp: support combine_capture argument.
+ - tests: ordered tox dependencies for pylxd install
+ - util: add get_linux_distro function to replace platform.dist
+ [Robert Schweikert]
+ - pyflakes: fix unused variable references identified by pyflakes 2.0.0.
+ - - Do not use the systemd_prefix macro, not available in this environment
+ [Robert Schweikert]
+ - doc: Add config info to ec2, openstack and cloudstack datasource docs
+ - Enable SmartOS network metadata to work with netplan via per-subnet
+ routes [Dan McDonald]
+ - openstack: Allow discovery in init-local using dhclient in a sandbox.
+ - tests: Avoid using https in httpretty, improve HttPretty test case.
+ - yaml_load/schema: Add invalid line and column nums to error message
+ - Azure: Ignore NTFS mount errors when checking ephemeral drive
+ [Paul Meyer]
+ - packages/brpm: Get proper dependencies for cmdline distro.
+ - packages: Make rpm spec files patch in package version like in debs.
+ - tools/run-container: replace tools/run-centos with more generic.
+ - Update version.version_string to contain packaged version.
+ - cc_mounts: Do not add devices to fstab that are already present.
+ [Lars Kellogg-Stedman]
+ - ds-identify: ensure that we have certain tokens in PATH.
+ - tests: enable Ubuntu Cosmic in integration tests [Joshua Powers]
+ - read_file_or_url: move to url_helper, fix bug in its FileResponse.
+ - cloud_tests: help pylint
+ - flake8: fix flake8 errors in previous commit.
+ - typos: Fix spelling mistakes in cc_mounts.py log messages [Stephen Ford]
+ - tests: restructure SSH and initial connections [Joshua Powers]
+ - ds-identify: recognize container-other as a container, test SmartOS.
+ - cloud-config.service: run After snap.seeded.service.
+ - tests: do not rely on host /proc/cmdline in test_net.py
+ [Lars Kellogg-Stedman]
+ - ds-identify: Remove dupe call to is_ds_enabled, improve debug message.
+ - SmartOS: fix get_interfaces for nics that do not have addr_assign_type.
+ - tests: fix package and ca_cert cloud_tests on bionic
+ - ds-identify: make shellcheck 0.4.6 happy with ds-identify.
+ - pycodestyle: Fix deprecated string literals, move away from flake8.
+ - azure: Add reported ready marker file. [Joshua Chan]
+ - tools: Support adding a release suffix through packages/bddeb.
+ - FreeBSD: Invoke growfs on ufs filesystems such that it does not prompt.
+ [Harm Weites]
+ - tools: Re-use the orig tarball in packages/bddeb if it is around.
+ - netinfo: fix netdev_pformat when a nic does not have an address assigned.
+ - collect-logs: add -v flag, write to stderr, limit journal to single boot.
+ - IBMCloud: Disable config-drive and nocloud only if IBMCloud is enabled.
+ - Add reporting events and log_time around early source of blocking time
+ - IBMCloud: recognize provisioning environment during debug boots.
+ - net: detect unstable network names and trigger a settle if needed
+ - IBMCloud: improve documentation in datasource.
+ - sysconfig: dhcp6 subnet type should not imply dhcpv4 [Vitaly Kuznetsov]
+ - packages/debian/control.in: add missing dependency on iproute2.
+ - DataSourceSmartOS: add locking of serial device. [Mike Gerdts]
+ - DataSourceSmartOS: sdc:hostname is ignored [Mike Gerdts]
+ - DataSourceSmartOS: list() should always return a list [Mike Gerdts]
+ - schema: in validation, raise ImportError if strict but no jsonschema.
+ - set_passwords: Add newline to end of sshd config, only restart if
+ updated.
+ - pylint: pay attention to unused variable warnings.
+ - doc: Add documentation for AliYun datasource. [Junjie Wang]
+ - Schema: do not warn on duplicate items in commands.
+ - net: Depend on iproute2's ip instead of net-tools ifconfig or route
+ - DataSourceSmartOS: fix hang when metadata service is down [Mike Gerdts]
+ - DataSourceSmartOS: change default fs on ephemeral disk from ext3 to
+ ext4. [Mike Gerdts]
+ - pycodestyle: Fix invalid escape sequences in string literals.
+ - Implement bash completion script for cloud-init command line
+ - tools: Fix make-tarball cli tool usage for development
+ - renderer: support unicode in render_from_file.
+ - Implement ntp client spec with auto support for distro selection
+ - Apport: add Brightbox, IBM, LXD, and OpenTelekomCloud to list of clouds.
+ - tests: fix ec2 integration network metadata validation
+
+ -- Chad Smith <chad.smith@canonical.com> Thu, 21 Jun 2018 14:32:29 -0600
+
+cloud-init (18.2-4-g05926e48-0ubuntu1~16.04.2) xenial-proposed; urgency=medium
+
+ * cherry-pick 6ef92c98: IBMCloud: recognize provisioning environment
+ during debug (LP: #1767166)
+ * cherry-pick 11172924: IBMCloud: Disable config-drive and nocloud
+ only if IBMCloud (LP: #1766401)
+
+ -- Chad Smith <chad.smith@canonical.com> Mon, 30 Apr 2018 15:52:05 -0600
+
cloud-init (18.2-4-g05926e48-0ubuntu1~16.04.1) xenial-proposed; urgency=medium
* debian/new-upstream-snapshot: Remove script, now maintained elsewhere.
diff --git a/debian/patches/azure-apply-network-config-false.patch b/debian/patches/azure-apply-network-config-false.patch
new file mode 100644
index 00000000..281c19c6
--- /dev/null
+++ b/debian/patches/azure-apply-network-config-false.patch
@@ -0,0 +1,23 @@
+Description: Azure apply_network_config default to False
+ Azure cloud-images on Xenial already contain hotplug network scripts so
+ default behavior for should remain to only generate fallback network
+ configuration which is to dhcp on eth0 and let image hotplug scripts add
+ network configuration for any additional nics that show up.
+Author: Chad Smith <chad.smith@canonical.com>
+Origin: backport
+Bug: https://bugs.launchpad.net/cloud-init/+bug/1798424
+Forwarded: not-needed
+Last-Update: 2018-10-17
+Index: cloud-init/cloudinit/sources/DataSourceAzure.py
+===================================================================
+--- cloud-init.orig/cloudinit/sources/DataSourceAzure.py
++++ cloud-init/cloudinit/sources/DataSourceAzure.py
+@@ -207,7 +207,7 @@ BUILTIN_DS_CONFIG = {
+ },
+ 'disk_aliases': {'ephemeral0': RESOURCE_DISK_PATH},
+ 'dhclient_lease_file': LEASE_FILE,
+- 'apply_network_config': True, # Use IMDS published network configuration
++ 'apply_network_config': False, # Use fallback network config not IMDS
+ }
+ # RELEASE_BLOCKER: Xenial and earlier apply_network_config default is False
+
diff --git a/debian/patches/azure-use-walinux-agent.patch b/debian/patches/azure-use-walinux-agent.patch
index 2113b75d..3c858824 100644
--- a/debian/patches/azure-use-walinux-agent.patch
+++ b/debian/patches/azure-use-walinux-agent.patch
@@ -6,12 +6,12 @@ Forwarded: not-needed
Author: Scott Moser <smoser@ubuntu.com>
--- a/cloudinit/sources/DataSourceAzure.py
+++ b/cloudinit/sources/DataSourceAzure.py
-@@ -190,7 +190,7 @@ if util.is_FreeBSD():
+@@ -196,7 +196,7 @@ if util.is_FreeBSD():
LOG.debug("resource disk is None")
BUILTIN_DS_CONFIG = {
- 'agent_command': AGENT_START_BUILTIN,
+ 'agent_command': AGENT_START,
- 'data_dir': "/var/lib/waagent",
+ 'data_dir': AGENT_SEED_DIR,
'set_hostname': True,
'hostname_bounce': {
diff --git a/debian/patches/cpick-1d5e9aef-azure-Add-apply_network_config-option-to-disable b/debian/patches/cpick-1d5e9aef-azure-Add-apply_network_config-option-to-disable
new file mode 100644
index 00000000..67f9f0e6
--- /dev/null
+++ b/debian/patches/cpick-1d5e9aef-azure-Add-apply_network_config-option-to-disable
@@ -0,0 +1,228 @@
+From 1d5e9aefdab06a2574d78e644deed6c6fa1da171 Mon Sep 17 00:00:00 2001
+From: Chad Smith <chad.smith@canonical.com>
+Date: Wed, 17 Oct 2018 18:47:35 +0000
+Subject: [PATCH] azure: Add apply_network_config option to disable network
+ from IMDS
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Azure generates network configuration from the IMDS service and removes
+any preexisting hotplug network scripts which exist in Azure cloud images.
+Add a datasource configuration option which allows for writing a default
+network configuration which sets up dhcp on eth0 and leave the hotplug
+handling to the cloud-image scripts.
+
+To disable network-config from Azure IMDS, add the following to
+/etc/cloud/cloud.cfg.d/99-azure-no-imds-network.cfg:
+datasource:
+  Azure:
+    apply_network_config: False
+
+LP: #1798424
+---
+ cloudinit/sources/DataSourceAzure.py | 11 +++-
+ doc/rtd/topics/datasources/azure.rst | 46 +++++++++++++++
+ tests/unittests/test_datasource/test_azure.py | 56 +++++++++++++++++--
+ 3 files changed, 107 insertions(+), 6 deletions(-)
+
+--- a/cloudinit/sources/DataSourceAzure.py
++++ b/cloudinit/sources/DataSourceAzure.py
+@@ -207,7 +207,9 @@ BUILTIN_DS_CONFIG = {
+ },
+ 'disk_aliases': {'ephemeral0': RESOURCE_DISK_PATH},
+ 'dhclient_lease_file': LEASE_FILE,
++ 'apply_network_config': True, # Use IMDS published network configuration
+ }
++# RELEASE_BLOCKER: Xenial and earlier apply_network_config default is False
+
+ BUILTIN_CLOUD_CONFIG = {
+ 'disk_setup': {
+@@ -450,7 +452,8 @@ class DataSourceAzure(sources.DataSource
+ except sources.InvalidMetaDataException as e:
+ LOG.warning('Could not crawl Azure metadata: %s', e)
+ return False
+- if self.distro and self.distro.name == 'ubuntu':
++ if (self.distro and self.distro.name == 'ubuntu' and
++ self.ds_cfg.get('apply_network_config')):
+ maybe_remove_ubuntu_network_config_scripts()
+
+ # Process crawled data and augment with various config defaults
+@@ -611,7 +614,11 @@ class DataSourceAzure(sources.DataSource
+ the blacklisted devices.
+ """
+ if not self._network_config:
+- self._network_config = parse_network_config(self._metadata_imds)
++ if self.ds_cfg.get('apply_network_config'):
++ nc_src = self._metadata_imds
++ else:
++ nc_src = None
++ self._network_config = parse_network_config(nc_src)
+ return self._network_config
+
+
+--- a/doc/rtd/topics/datasources/azure.rst
++++ b/doc/rtd/topics/datasources/azure.rst
+@@ -57,6 +57,52 @@ in order to use waagent.conf with cloud-
+ ResourceDisk.MountPoint=/mnt
+
+
++Configuration
++-------------
++The following configuration can be set for the datasource in system
++configuration (in `/etc/cloud/cloud.cfg` or `/etc/cloud/cloud.cfg.d/`).
++
++The settings that may be configured are:
++
++ * **agent_command**: Either __builtin__ (default) or a command to run to getcw
++ metadata. If __builtin__, get metadata from walinuxagent. Otherwise run the
++ provided command to obtain metadata.
++ * **apply_network_config**: Boolean set to True to use network configuration
++ described by Azure's IMDS endpoint instead of fallback network config of
++ dhcp on eth0. Default is True. For Ubuntu 16.04 or earlier, default is False.
++ * **data_dir**: Path used to read metadata files and write crawled data.
++ * **dhclient_lease_file**: The fallback lease file to source when looking for
++ custom DHCP option 245 from Azure fabric.
++ * **disk_aliases**: A dictionary defining which device paths should be
++ interpreted as ephemeral images. See cc_disk_setup module for more info.
++ * **hostname_bounce**: A dictionary Azure hostname bounce behavior to react to
++ metadata changes.
++ * **hostname_bounce**: A dictionary Azure hostname bounce behavior to react to
++ metadata changes. Azure will throttle ifup/down in some cases after metadata
++ has been updated to inform dhcp server about updated hostnames.
++ * **set_hostname**: Boolean set to True when we want Azure to set the hostname
++ based on metadata.
++
++An example configuration with the default values is provided below:
++
++.. sourcecode:: yaml
++
++ datasource:
++ Azure:
++ agent_command: __builtin__
++ apply_network_config: true
++ data_dir: /var/lib/waagent
++ dhclient_lease_file: /var/lib/dhcp/dhclient.eth0.leases
++ disk_aliases:
++ ephemeral0: /dev/disk/cloud/azure_resource
++ hostname_bounce:
++ interface: eth0
++ command: builtin
++ policy: true
++ hostname_command: hostname
++ set_hostname: true
++
++
+ Userdata
+ --------
+ Userdata is provided to cloud-init inside the ovf-env.xml file. Cloud-init
+--- a/tests/unittests/test_datasource/test_azure.py
++++ b/tests/unittests/test_datasource/test_azure.py
+@@ -254,7 +254,8 @@ scbus-1 on xpt0 bus 0
+ ])
+ return dsaz
+
+- def _get_ds(self, data, agent_command=None, distro=None):
++ def _get_ds(self, data, agent_command=None, distro=None,
++ apply_network=None):
+
+ def dsdevs():
+ return data.get('dsdevs', [])
+@@ -310,6 +311,8 @@ scbus-1 on xpt0 bus 0
+ data.get('sys_cfg', {}), distro=distro, paths=self.paths)
+ if agent_command is not None:
+ dsrc.ds_cfg['agent_command'] = agent_command
++ if apply_network is not None:
++ dsrc.ds_cfg['apply_network_config'] = apply_network
+
+ return dsrc
+
+@@ -414,14 +417,26 @@ fdescfs /dev/fd fdes
+
+ def test_get_data_on_ubuntu_will_remove_network_scripts(self):
+ """get_data will remove ubuntu net scripts on Ubuntu distro."""
++ sys_cfg = {'datasource': {'Azure': {'apply_network_config': True}}}
+ odata = {'HostName': "myhost", 'UserName': "myuser"}
+ data = {'ovfcontent': construct_valid_ovf_env(data=odata),
+- 'sys_cfg': {}}
++ 'sys_cfg': sys_cfg}
+
+ dsrc = self._get_ds(data, distro='ubuntu')
+ dsrc.get_data()
+ self.m_remove_ubuntu_network_scripts.assert_called_once_with()
+
++ def test_get_data_on_ubuntu_will_not_remove_network_scripts_disabled(self):
++ """When apply_network_config false, do not remove scripts on Ubuntu."""
++ sys_cfg = {'datasource': {'Azure': {'apply_network_config': False}}}
++ odata = {'HostName': "myhost", 'UserName': "myuser"}
++ data = {'ovfcontent': construct_valid_ovf_env(data=odata),
++ 'sys_cfg': sys_cfg}
++
++ dsrc = self._get_ds(data, distro='ubuntu')
++ dsrc.get_data()
++ self.m_remove_ubuntu_network_scripts.assert_not_called()
++
+ def test_crawl_metadata_returns_structured_data_and_caches_nothing(self):
+ """Return all structured metadata and cache no class attributes."""
+ yaml_cfg = "{agent_command: my_command}\n"
+@@ -503,8 +518,10 @@ fdescfs /dev/fd fdes
+
+ def test_network_config_set_from_imds(self):
+ """Datasource.network_config returns IMDS network data."""
++ sys_cfg = {'datasource': {'Azure': {'apply_network_config': True}}}
+ odata = {}
+- data = {'ovfcontent': construct_valid_ovf_env(data=odata)}
++ data = {'ovfcontent': construct_valid_ovf_env(data=odata),
++ 'sys_cfg': sys_cfg}
+ expected_network_config = {
+ 'ethernets': {
+ 'eth0': {'set-name': 'eth0',
+@@ -783,9 +800,10 @@ fdescfs /dev/fd fdes
+ @mock.patch('cloudinit.net.generate_fallback_config')
+ def test_imds_network_config(self, mock_fallback):
+ """Network config is generated from IMDS network data when present."""
++ sys_cfg = {'datasource': {'Azure': {'apply_network_config': True}}}
+ odata = {'HostName': "myhost", 'UserName': "myuser"}
+ data = {'ovfcontent': construct_valid_ovf_env(data=odata),
+- 'sys_cfg': {}}
++ 'sys_cfg': sys_cfg}
+
+ dsrc = self._get_ds(data)
+ ret = dsrc.get_data()
+@@ -803,6 +821,36 @@ fdescfs /dev/fd fdes
+
+ @mock.patch('cloudinit.net.get_interface_mac')
+ @mock.patch('cloudinit.net.get_devicelist')
++ @mock.patch('cloudinit.net.device_driver')
++ @mock.patch('cloudinit.net.generate_fallback_config')
++ def test_imds_network_ignored_when_apply_network_config_false(
++ self, mock_fallback, mock_dd, mock_devlist, mock_get_mac):
++ """When apply_network_config is False, use fallback instead of IMDS."""
++ sys_cfg = {'datasource': {'Azure': {'apply_network_config': False}}}
++ odata = {'HostName': "myhost", 'UserName': "myuser"}
++ data = {'ovfcontent': construct_valid_ovf_env(data=odata),
++ 'sys_cfg': sys_cfg}
++ fallback_config = {
++ 'version': 1,
++ 'config': [{
++ 'type': 'physical', 'name': 'eth0',
++ 'mac_address': '00:11:22:33:44:55',
++ 'params': {'driver': 'hv_netsvc'},
++ 'subnets': [{'type': 'dhcp'}],
++ }]
++ }
++ mock_fallback.return_value = fallback_config
++
++ mock_devlist.return_value = ['eth0']
++ mock_dd.return_value = ['hv_netsvc']
++ mock_get_mac.return_value = '00:11:22:33:44:55'
++
++ dsrc = self._get_ds(data)
++ self.assertTrue(dsrc.get_data())
++ self.assertEqual(dsrc.network_config, fallback_config)
++
++ @mock.patch('cloudinit.net.get_interface_mac')
++ @mock.patch('cloudinit.net.get_devicelist')
+ @mock.patch('cloudinit.net.device_driver')
+ @mock.patch('cloudinit.net.generate_fallback_config')
+ def test_fallback_network_config(self, mock_fallback, mock_dd,
diff --git a/debian/patches/ds-identify-behavior-xenial.patch b/debian/patches/ds-identify-behavior-xenial.patch
index 0bcfb372..ba7639ab 100644
--- a/debian/patches/ds-identify-behavior-xenial.patch
+++ b/debian/patches/ds-identify-behavior-xenial.patch
@@ -10,7 +10,7 @@ Bug-ubuntu: http://bugs.launchpad.net/bugs/1660385
--- a/tools/ds-identify
+++ b/tools/ds-identify
-@@ -84,8 +84,8 @@ _DI_LOGGED=""
+@@ -93,8 +93,8 @@ _DI_LOGGED=""
DI_MAIN=${DI_MAIN:-main}
DI_BLKID_OUTPUT=""
@@ -21,7 +21,7 @@ Bug-ubuntu: http://bugs.launchpad.net/bugs/1660385
DI_DMI_CHASSIS_ASSET_TAG=""
DI_DMI_PRODUCT_NAME=""
DI_DMI_SYS_VENDOR=""
-@@ -122,7 +122,7 @@ DI_ON_FOUND=""
+@@ -131,7 +131,7 @@ DI_ON_FOUND=""
DI_ON_MAYBE=""
DI_ON_NOTFOUND=""
diff --git a/debian/patches/openstack-no-network-config.patch b/debian/patches/openstack-no-network-config.patch
new file mode 100644
index 00000000..88449d1d
--- /dev/null
+++ b/debian/patches/openstack-no-network-config.patch
@@ -0,0 +1,40 @@
+Description: Fallback network config instead of network_data.json for OpenStack
+ To make this acceptable as a SRU we keep the same behavior as is
+ in the stable release which is to generate network for fallback nic
+ only.
+ .
+ In this series, OpenStack datasource can optionally generate
+ network_config from network_data.json if the datasource is configured
+ with a file like /etc/cloud.cfg.d/openstack-net.cfg:
+ .
+ datasource:
+ OpenStack:
+ apply_network_config: true
+Forwarded: not-needed
+Author: Chad Smith <chad.smith@canonical.com>
+
+--- a/cloudinit/sources/DataSourceOpenStack.py
++++ b/cloudinit/sources/DataSourceOpenStack.py
+@@ -98,10 +98,9 @@ class DataSourceOpenStack(openstack.Sour
+ if self._network_config != sources.UNSET:
+ return self._network_config
+
+- # RELEASE_BLOCKER: SRU to Xenial and Artful SRU should not provide
++ # Xenial, Artful and Bionic will not provide
+ # network_config by default unless configured in /etc/cloud/cloud.cfg*.
+- # Patch Xenial and Artful before release to default to False.
+- if util.is_false(self.ds_cfg.get('apply_network_config', True)):
++ if util.is_false(self.ds_cfg.get('apply_network_config', False)):
+ self._network_config = None
+ return self._network_config
+ if self.network_json == sources.UNSET:
+--- a/tests/unittests/test_datasource/test_openstack.py
++++ b/tests/unittests/test_datasource/test_openstack.py
+@@ -345,6 +345,7 @@ class TestOpenStackDataSource(test_helpe
+ settings.CFG_BUILTIN, None, helpers.Paths({'run_dir': self.tmp}))
+ sample_json = {'links': [{'ethernet_mac_address': 'mymac'}],
+ 'networks': [], 'services': []}
++ ds_os.ds_cfg = {'apply_network_config': True} # Default is False
+ ds_os.network_json = sample_json
+ with test_helpers.mock.patch(mock_path) as m_convert_json:
+ m_convert_json.return_value = example_cfg
diff --git a/debian/patches/series b/debian/patches/series
index 7e909afc..0e264119 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,6 @@
azure-use-walinux-agent.patch
ds-identify-behavior-xenial.patch
stable-release-no-jsonschema-dep.patch
+openstack-no-network-config.patch
+cpick-1d5e9aef-azure-Add-apply_network_config-option-to-disable
+azure-apply-network-config-false.patch
diff --git a/debian/rules b/debian/rules
index 72754aab..c5b18ebb 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,6 +1,7 @@
#!/usr/bin/make -f
INIT_SYSTEM ?= upstart,systemd
export PYBUILD_INSTALL_ARGS=--init-system=$(INIT_SYSTEM)
+DEB_VERSION := $(shell dpkg-parsechangelog --show-field=Version)
%:
dh $@ --with python3,systemd --buildsystem pybuild
@@ -21,3 +22,4 @@ override_dh_auto_install:
install -D ./tools/Z99-cloud-locale-test.sh debian/cloud-init/etc/profile.d/Z99-cloud-locale-test.sh
install -D ./tools/Z99-cloudinit-warnings.sh debian/cloud-init/etc/profile.d/Z99-cloudinit-warnings.sh
install -m 0644 -D debian/apport-launcher.py debian/cloud-init/usr/share/apport/package-hooks/cloud-init.py
+ flist=$$(find $(CURDIR)/debian/ -type f -name version.py) && sed -i 's,@@PACKAGED_VERSION@@,$(DEB_VERSION),' $${flist:-did-not-find-version-py-for-replacement}