Merge ~mgerdts/cloud-init:lp1765801.1 into cloud-init:master

Proposed by Mike Gerdts
Status: Merged
Approved by: Ryan Harper
Approved revision: caff922b0d2b430e597e9d86f46a4d2f22d8ec73
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~mgerdts/cloud-init:lp1765801.1
Merge into: cloud-init:master
Diff against target: 70 lines (+15/-2)
2 files modified
cloudinit/sources/DataSourceSmartOS.py (+7/-1)
tests/unittests/test_datasource/test_smartos.py (+8/-1)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Ryan Harper Approve
Review via email: mp+374989@code.launchpad.net

Commit message

DataSourceSmartOS: reconfigure network on each boot

In typical cases, SmartOS does not use DHCP for network configuration.
As such, if the network configuration changes that is reflected in
metadata and will be picked up during the next boot.

LP: #1765801
Joyent: OS-6902 cloud-init should reconfigure network on each boot

To post a comment you must log in.
Revision history for this message
Mike Gerdts (mgerdts) wrote :

I've created a fresh branch and submitted a new merge proposal to get past the bogus diff shown in https://code.launchpad.net/~mgerdts/cloud-init/+git/cloud-init/+merge/374987

Revision history for this message
Ryan Harper (raharper) wrote :

This looks fine to me. I'm pointing CI at this. One question, in the previous Merge Proposal there was a comment around emitting network: {config: disabled} in some cases. Is that related to this change?

Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:caff922b0d2b430e597e9d86f46a4d2f22d8ec73
https://jenkins.ubuntu.com/server/job/cloud-init-ci/1242/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/1242//rebuild

review: Approve (continuous-integration)
Revision history for this message
Ryan Harper (raharper) wrote :

Discussed in IRC, the comment around disabling network-config is not currently relevant.
This passed CI and looks good to me.

Thanks!

review: Approve
Revision history for this message
Server Team CI bot (server-team-bot) :
review: Approve (continuous-integration)
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

Commit message lints:
- Line #7 has 3 too many characters. Line starts with: "Joyent: OS-6902 cloud-init"...

review: Needs Fixing
Revision history for this message
Server Team CI bot (server-team-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/cloudinit/sources/DataSourceSmartOS.py b/cloudinit/sources/DataSourceSmartOS.py
index 32b57cd..cf67650 100644
--- a/cloudinit/sources/DataSourceSmartOS.py
+++ b/cloudinit/sources/DataSourceSmartOS.py
@@ -1,5 +1,5 @@
1# Copyright (C) 2013 Canonical Ltd.1# Copyright (C) 2013 Canonical Ltd.
2# Copyright (c) 2018, Joyent, Inc.2# Copyright 2019 Joyent, Inc.
3#3#
4# Author: Ben Howard <ben.howard@canonical.com>4# Author: Ben Howard <ben.howard@canonical.com>
5#5#
@@ -34,6 +34,7 @@ from cloudinit import log as logging
34from cloudinit import serial34from cloudinit import serial
35from cloudinit import sources35from cloudinit import sources
36from cloudinit import util36from cloudinit import util
37from cloudinit.event import EventType
3738
38LOG = logging.getLogger(__name__)39LOG = logging.getLogger(__name__)
3940
@@ -178,6 +179,7 @@ class DataSourceSmartOS(sources.DataSource):
178 self.metadata = {}179 self.metadata = {}
179 self.network_data = None180 self.network_data = None
180 self._network_config = None181 self._network_config = None
182 self.update_events['network'].add(EventType.BOOT)
181183
182 self.script_base_d = os.path.join(self.paths.get_cpath("scripts"))184 self.script_base_d = os.path.join(self.paths.get_cpath("scripts"))
183185
@@ -319,6 +321,10 @@ class DataSourceSmartOS(sources.DataSource):
319321
320 @property322 @property
321 def network_config(self):323 def network_config(self):
324 # sources.clear_cached_data() may set _network_config to '_unset'.
325 if self._network_config == sources.UNSET:
326 self._network_config = None
327
322 if self._network_config is None:328 if self._network_config is None:
323 if self.network_data is not None:329 if self.network_data is not None:
324 self._network_config = (330 self._network_config = (
diff --git a/tests/unittests/test_datasource/test_smartos.py b/tests/unittests/test_datasource/test_smartos.py
index 42ac697..d5b1c29 100644
--- a/tests/unittests/test_datasource/test_smartos.py
+++ b/tests/unittests/test_datasource/test_smartos.py
@@ -1,5 +1,5 @@
1# Copyright (C) 2013 Canonical Ltd.1# Copyright (C) 2013 Canonical Ltd.
2# Copyright (c) 2018, Joyent, Inc.2# Copyright 2019 Joyent, Inc.
3#3#
4# Author: Ben Howard <ben.howard@canonical.com>4# Author: Ben Howard <ben.howard@canonical.com>
5#5#
@@ -31,6 +31,7 @@ from cloudinit.sources.DataSourceSmartOS import (
31 convert_smartos_network_data as convert_net,31 convert_smartos_network_data as convert_net,
32 SMARTOS_ENV_KVM, SERIAL_DEVICE, get_smartos_environ,32 SMARTOS_ENV_KVM, SERIAL_DEVICE, get_smartos_environ,
33 identify_file)33 identify_file)
34from cloudinit.event import EventType
3435
35import six36import six
3637
@@ -653,6 +654,12 @@ class TestSmartOSDataSource(FilesystemMockingTestCase):
653 self.assertEqual(dsrc.device_name_to_device('FOO'),654 self.assertEqual(dsrc.device_name_to_device('FOO'),
654 mydscfg['disk_aliases']['FOO'])655 mydscfg['disk_aliases']['FOO'])
655656
657 def test_reconfig_network_on_boot(self):
658 # Test to ensure that network is configured from metadata on each boot
659 dsrc = self._get_ds(mockdata=MOCK_RETURNS)
660 self.assertSetEqual(set([EventType.BOOT_NEW_INSTANCE, EventType.BOOT]),
661 dsrc.update_events['network'])
662
656663
657class TestIdentifyFile(CiTestCase):664class TestIdentifyFile(CiTestCase):
658 """Test the 'identify_file' utility."""665 """Test the 'identify_file' utility."""

Subscribers

People subscribed via source and target branches