Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion cloudinit/sources/DataSourceAzure.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from cloudinit import dmi
from cloudinit import log as logging
from cloudinit import net
from cloudinit.event import EventType
from cloudinit.event import EventScope, EventType
from cloudinit.net import device_driver
from cloudinit.net.dhcp import EphemeralDHCPv4
from cloudinit import sources
Expand Down Expand Up @@ -339,6 +339,10 @@ def temporary_hostname(temp_hostname, cfg, hostname_command='hostname'):
class DataSourceAzure(sources.DataSource):

dsname = 'Azure'
default_update_events = {EventScope.NETWORK: {
EventType.BOOT_NEW_INSTANCE,
EventType.BOOT,
}}
_negotiated = False
_metadata_imds = sources.UNSET
_ci_pkl_version = 1
Expand Down
10 changes: 6 additions & 4 deletions tests/integration_tests/modules/test_user_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ def _add_dummy_bridge_to_netplan(client: IntegrationInstance):
@pytest.mark.gce
@pytest.mark.oci
@pytest.mark.openstack
@pytest.mark.azure
@pytest.mark.not_xenial
def test_boot_event_disabled_by_default(client: IntegrationInstance):
log = client.read_from_file('/var/log/cloud-init.log')
if 'network config is disabled' in log:
Expand Down Expand Up @@ -77,7 +75,7 @@ def _test_network_config_applied_on_reboot(client: IntegrationInstance):
assert 'dummy0' not in client.execute('ls /sys/class/net')

_add_dummy_bridge_to_netplan(client)
client.execute('rm /var/log/cloud-init.log')
client.execute('echo "" > /var/log/cloud-init.log')
Comment thread
blackboxsw marked this conversation as resolved.
client.restart()

log = client.read_from_file('/var/log/cloud-init.log')
Expand All @@ -92,6 +90,11 @@ def _test_network_config_applied_on_reboot(client: IntegrationInstance):
assert 'dummy0' not in client.execute('ls /sys/class/net')


@pytest.mark.azure
def test_boot_event_enabled_by_default(client: IntegrationInstance):
_test_network_config_applied_on_reboot(client)


USER_DATA = """\
#cloud-config
updates:
Expand All @@ -100,7 +103,6 @@ def _test_network_config_applied_on_reboot(client: IntegrationInstance):
"""


@pytest.mark.not_xenial
@pytest.mark.user_data(USER_DATA)
def test_boot_event_enabled(client: IntegrationInstance):
_test_network_config_applied_on_reboot(client)