diff options
author | Scott Moser <smoser@ubuntu.com> | 2016-03-21 21:47:24 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2016-03-21 21:47:24 -0400 |
commit | 0964b42e5117cce640a8ba9102a76fa54a698898 (patch) | |
tree | 7dcd74e20a78d71a76ca4027c32677e3e586bc40 /cloudinit/sources/DataSourceAzure.py | |
parent | 1b91b7cee6f2d4a2a7ddaf5f963225f0d36d1963 (diff) | |
download | vyos-cloud-init-0964b42e5117cce640a8ba9102a76fa54a698898.tar.gz vyos-cloud-init-0964b42e5117cce640a8ba9102a76fa54a698898.zip |
quickly check to see if the previous instance id is still valid
This adds a check in cloud-init to see if the existing (cached)
datasource is still valid. It relies on support from the Datasource
to implement 'check_instance_id'. That method should quickly determine
(if possible) if the instance id found in the datasource is still valid.
This means that we can still notice new instance ids without
depending on a network datasource on every boot.
I've also implemented check_instance_id for the superclass and for
3 classes:
DataSourceAzure (check dmi data)
DataSourceOpenstack (check dmi data)
DataSourceNocloud (check the seeded data or kernel command line)
LP: #1553815
Diffstat (limited to 'cloudinit/sources/DataSourceAzure.py')
-rw-r--r-- | cloudinit/sources/DataSourceAzure.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py index 2af0ad9b..832b3063 100644 --- a/cloudinit/sources/DataSourceAzure.py +++ b/cloudinit/sources/DataSourceAzure.py @@ -254,6 +254,10 @@ class DataSourceAzureNet(sources.DataSource): def get_config_obj(self): return self.cfg + def check_instance_id(self): + # quickly (local check only) if self.instance_id is still valid + return sources.instance_id_matches_system_uuid(self.get_instance_id()) + def count_files(mp): return len(fnmatch.filter(os.listdir(mp), '*[!cdrom]*')) |