summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceGCE.py
diff options
context:
space:
mode:
authorAlberto Contreras <alberto.contreras@canonical.com>2023-04-27 21:11:07 +0200
committerGitHub <noreply@github.com>2023-04-27 14:11:07 -0500
commitaa0cd62c81866d632522bbc54dc03eb4fa7fd913 (patch)
tree9e861a7841de93b125ea325dc6043cd62fc40b0f /cloudinit/sources/DataSourceGCE.py
parentbe3441b217949f608cf1cba677e3484ba49f7e7b (diff)
downloadcloud-init-git-aa0cd62c81866d632522bbc54dc03eb4fa7fd913.tar.gz
gce: activate network discovery on every boot (#2128)
Google wants to allow users to make changes on nics while the instance is stopped. Activate network discovery on every boot. Additionally, skip the call to `netplan generate` if the rendered config is the same on subsequent boots.
Diffstat (limited to 'cloudinit/sources/DataSourceGCE.py')
-rw-r--r--cloudinit/sources/DataSourceGCE.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/cloudinit/sources/DataSourceGCE.py b/cloudinit/sources/DataSourceGCE.py
index 041c8914..27d6089a 100644
--- a/cloudinit/sources/DataSourceGCE.py
+++ b/cloudinit/sources/DataSourceGCE.py
@@ -11,6 +11,7 @@ from cloudinit import dmi
from cloudinit import log as logging
from cloudinit import sources, url_helper, util
from cloudinit.distros import ug_util
+from cloudinit.event import EventScope, EventType
from cloudinit.net.ephemeral import EphemeralDHCPv4
from cloudinit.sources import DataSourceHostname
@@ -63,6 +64,12 @@ class DataSourceGCE(sources.DataSource):
dsname = "GCE"
perform_dhcp_setup = False
+ default_update_events = {
+ EventScope.NETWORK: {
+ EventType.BOOT_NEW_INSTANCE,
+ EventType.BOOT,
+ }
+ }
def __init__(self, sys_cfg, distro, paths):
sources.DataSource.__init__(self, sys_cfg, distro, paths)