diff options
author | Brett Holman <brett.holman@canonical.com> | 2023-03-19 19:24:49 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-19 20:24:49 -0500 |
commit | a60c0845806baff72c74603286d048efbafab664 (patch) | |
tree | 4ae8acc8555cc90948e8895ca72f599c4ec96d3a /cloudinit/sources/DataSourceExoscale.py | |
parent | 3634678465e7b8f8608bcb9a1f5773ae7837cbe9 (diff) | |
download | cloud-init-git-a60c0845806baff72c74603286d048efbafab664.tar.gz |
datasource: Optimize datasource detection, fix bugs (#2060)
Commit d1ffbea556a06105 enabled skipping python datasource detection on
OpenStack when no other datasources (besides DataSourceNone) can be discovered.
This allowed one to override detection, which is a requirement for OpenStack
Ironic which does not advertise itself to cloud-init.
Since no further datasources can be detected at this stage in the code, this
pattern can be generalized to other datasources to facilitate troubleshooting
or providing a general workaround to runtime detection bugs.
Additionally, this pattern can be extended to kernel commandline datasource
definition. Since kernel commandline is highest priority of the
configurations, it makes sense to override python code datasource
detection as well.
Include an integration test on LXD for this behavior that configures kernel
commandline and reboots to verify that the specified datasource is forced.
Diffstat (limited to 'cloudinit/sources/DataSourceExoscale.py')
-rw-r--r-- | cloudinit/sources/DataSourceExoscale.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/cloudinit/sources/DataSourceExoscale.py b/cloudinit/sources/DataSourceExoscale.py index 23478e9e..cf42fdbb 100644 --- a/cloudinit/sources/DataSourceExoscale.py +++ b/cloudinit/sources/DataSourceExoscale.py @@ -100,9 +100,6 @@ class DataSourceExoscale(sources.DataSource): Please refer to the datasource documentation for details on how the metadata server and password server are crawled. """ - if not self._is_platform_viable(): - return False - data = util.log_time( logfunc=LOG.debug, msg="Crawl of metadata service", @@ -142,7 +139,8 @@ class DataSourceExoscale(sources.DataSource): def get_config_obj(self): return self.extra_config - def _is_platform_viable(self): + @staticmethod + def ds_detect(): return dmi.read_dmi_data("system-product-name").startswith( EXOSCALE_DMI_NAME ) |