From 9e904bbc3336b96475bfd00fb3bf1262ae4de49f Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Thu, 17 Nov 2016 14:46:23 -0500 Subject: Add activate_datasource, for datasource specific code paths. This adds a call to 'activate_datasource'. That will be called during init stage (or init-local in the event of a 'local' dsmode). It is present so that the datasource can do platform specific operations that may be necessary. It is passed the fully rendered cloud-config and whether or not the instance is a new instance. The Azure datasource uses this to address formatting of the ephemeral devices. It does so by a.) waiting for the device to come online b.) removing the marker files for the disk_setup and mounts modules if it finds that the ephemeral device has been reset. LP: #1611074 --- cloudinit/sources/__init__.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'cloudinit/sources/__init__.py') diff --git a/cloudinit/sources/__init__.py b/cloudinit/sources/__init__.py index d1395270..13fb7c62 100644 --- a/cloudinit/sources/__init__.py +++ b/cloudinit/sources/__init__.py @@ -261,6 +261,18 @@ class DataSource(object): def first_instance_boot(self): return + def activate(self, cfg, is_new_instance): + """activate(cfg, is_new_instance) + + This is called before the init_modules will be called. + The cfg is fully up to date config, it contains a merged view of + system config, datasource config, user config, vendor config. + It should be used rather than the sys_cfg passed to __init__. + + is_new_instance is a boolean indicating if this is a new instance. + """ + return + def normalize_pubkey_data(pubkey_data): keys = [] -- cgit v1.2.3