summaryrefslogtreecommitdiff
path: root/cloudinit/config/cc_final_message.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2012-08-20 21:27:04 -0400
committerScott Moser <smoser@ubuntu.com>2012-08-20 21:27:04 -0400
commit989252019b14c7147367ffddaa990b371438fa7c (patch)
treebe49fc53b38eca8eef5e074efa2e198a40004305 /cloudinit/config/cc_final_message.py
parenta2ebfe8f6f31ae6972620f271ab9fa935d46dff1 (diff)
parentc1d2bc7ff9824b967cca21ed0254e4ee47168b10 (diff)
downloadvyos-cloud-init-989252019b14c7147367ffddaa990b371438fa7c.tar.gz
vyos-cloud-init-989252019b14c7147367ffddaa990b371438fa7c.zip
Add the "None" datasource
The None datasource is the last resort fallback datasource. It is identifiable by a property 'is_disconnected' that indicates that the datasource used is "not connected to a datasource". This will allow any thing that needs to run to still run in the absense of a DataSource. Also, we add a logging of the datasource found in final_message, and a warning if the None datasource is found. LP: #906669
Diffstat (limited to 'cloudinit/config/cc_final_message.py')
-rw-r--r--cloudinit/config/cc_final_message.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/cloudinit/config/cc_final_message.py b/cloudinit/config/cc_final_message.py
index aff03c4e..6b864fda 100644
--- a/cloudinit/config/cc_final_message.py
+++ b/cloudinit/config/cc_final_message.py
@@ -28,7 +28,7 @@ frequency = PER_ALWAYS
# Cheetah formated default message
FINAL_MESSAGE_DEF = ("Cloud-init v. ${version} finished at ${timestamp}."
- " Up ${uptime} seconds.")
+ " Datasource ${datasource}. Up ${uptime} seconds")
def handle(_name, cfg, cloud, log, args):
@@ -51,6 +51,7 @@ def handle(_name, cfg, cloud, log, args):
'uptime': uptime,
'timestamp': ts,
'version': cver,
+ 'datasource': str(cloud.datasource),
}
util.multi_log("%s\n" % (templater.render_string(msg_in, subs)),
console=False, stderr=True)
@@ -63,3 +64,6 @@ def handle(_name, cfg, cloud, log, args):
util.write_file(boot_fin_fn, contents)
except:
util.logexc(log, "Failed to write boot finished file %s", boot_fin_fn)
+
+ if cloud.datasource.is_disconnected:
+ log.warn("Used fallback datasource")