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/DataSourceCloudSigma.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/DataSourceCloudSigma.py')
-rw-r--r-- | cloudinit/sources/DataSourceCloudSigma.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/cloudinit/sources/DataSourceCloudSigma.py b/cloudinit/sources/DataSourceCloudSigma.py index 270a3a18..1dcd7107 100644 --- a/cloudinit/sources/DataSourceCloudSigma.py +++ b/cloudinit/sources/DataSourceCloudSigma.py @@ -31,7 +31,8 @@ class DataSourceCloudSigma(sources.DataSource): self.ssh_public_key = "" sources.DataSource.__init__(self, sys_cfg, distro, paths) - def is_running_in_cloudsigma(self): + @staticmethod + def ds_detect(): """ Uses dmi data to detect if this instance of cloud-init is running in the CloudSigma's infrastructure. @@ -51,8 +52,6 @@ class DataSourceCloudSigma(sources.DataSource): as userdata. """ dsmode = None - if not self.is_running_in_cloudsigma(): - return False try: server_context = self.cepko.all().result |