From c9cd1c5c89a2fdf194a33bba3f282e626c79e488 Mon Sep 17 00:00:00 2001 From: Prakash Surya Date: Wed, 26 Aug 2020 13:05:35 -0700 Subject: [PATCH] Generate network config on first and subsequent boots This change modifies when cloud-init will generate the network config for the system, such that it will now be generated for the first boot (which it previously did) and all subsequent boots (which is new). This way, if the system's network hardware changes (e.g. the MAC address changes), the network configuration for the system will automatically adapt on the next boot. Also note that for a DE, this only applies when using the default cloud-init generated network configuration. Currently, the cloud-init config is only used prior to the DE administrator performing any manual network configuration via the API or CLI. After manual network changes are made, the DE will no longer use the cloud-init network config, at which point this change will no longer have any affect. --- cloudinit/sources/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cloudinit/sources/__init__.py b/cloudinit/sources/__init__.py index e6baf8f40..48f4ec71a 100644 --- a/cloudinit/sources/__init__.py +++ b/cloudinit/sources/__init__.py @@ -181,8 +181,8 @@ class DataSource(object): # A datasource which supports writing network config on each system boot # would call update_events['network'].add(EventType.BOOT). - # Default: generate network config on new instance id (first boot). - update_events = {'network': set([EventType.BOOT_NEW_INSTANCE])} + # Default: generate network config on first boot and subsequent boots. + update_events = {'network': set([EventType.BOOT_NEW_INSTANCE, EventType.BOOT])} # N-tuple listing default values for any metadata-related class # attributes cached on an instance by a process_data runs. These attribute