diff options
author | Scott Moser <smoser@ubuntu.com> | 2018-03-27 12:03:39 -0600 |
---|---|---|
committer | Chad Smith <chad.smith@canonical.com> | 2018-03-27 12:03:39 -0600 |
commit | 5e4641a3cd5eac5cbf8ffd13d32514fbb9424077 (patch) | |
tree | eca255cd66360acb6c867530d4adf278d7c98fce /cloudinit/sources/DataSourceHetzner.py | |
parent | 5b9dc4bc6a02acb26d568ab4633661a621d83620 (diff) | |
download | vyos-cloud-init-5e4641a3cd5eac5cbf8ffd13d32514fbb9424077.tar.gz vyos-cloud-init-5e4641a3cd5eac5cbf8ffd13d32514fbb9424077.zip |
Hetzner: Exit early if dmi system-manufacturer is not Hetzner.
This takes the same basic check that is in ds-identify. If the
DMI system manufacturer (aka sys_vendor) is not 'Hetzner', then exit
out of the datasource's get_data quickly.
Diffstat (limited to 'cloudinit/sources/DataSourceHetzner.py')
-rw-r--r-- | cloudinit/sources/DataSourceHetzner.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/cloudinit/sources/DataSourceHetzner.py b/cloudinit/sources/DataSourceHetzner.py index 769fe131..5c75b65b 100644 --- a/cloudinit/sources/DataSourceHetzner.py +++ b/cloudinit/sources/DataSourceHetzner.py @@ -44,6 +44,8 @@ class DataSourceHetzner(sources.DataSource): self.dsmode = sources.DSMODE_NETWORK def get_data(self): + if not on_hetzner(): + return False nic = cloudnet.find_fallback_nic() with cloudnet.EphemeralIPv4Network(nic, "169.254.0.1", 16, "169.254.255.255"): @@ -87,6 +89,10 @@ class DataSourceHetzner(sources.DataSource): return self._network_config +def on_hetzner(): + return util.read_dmi_data('system-manufacturer') == "Hetzner" + + # Used to match classes to dependencies datasources = [ (DataSourceHetzner, (sources.DEP_FILESYSTEM, )), |