summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceCloudSigma.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2015-01-26 17:05:21 -0500
committerBarry Warsaw <barry@python.org>2015-01-26 17:05:21 -0500
commitfe99f7d6d87e88320933957b2933288c6eb2986d (patch)
tree82aff0c8aecaf6e87cfb77aea04d944965bc25f5 /cloudinit/sources/DataSourceCloudSigma.py
parentfabff4aec884467729fc372bb67f240752c15511 (diff)
parent78915c97c18d678db10e0fde0d9306823c5f4610 (diff)
downloadvyos-cloud-init-fe99f7d6d87e88320933957b2933288c6eb2986d.tar.gz
vyos-cloud-init-fe99f7d6d87e88320933957b2933288c6eb2986d.zip
Trunk merged and ported.
Diffstat (limited to 'cloudinit/sources/DataSourceCloudSigma.py')
-rw-r--r--cloudinit/sources/DataSourceCloudSigma.py22
1 files changed, 10 insertions, 12 deletions
diff --git a/cloudinit/sources/DataSourceCloudSigma.py b/cloudinit/sources/DataSourceCloudSigma.py
index 707cd0ce..76597116 100644
--- a/cloudinit/sources/DataSourceCloudSigma.py
+++ b/cloudinit/sources/DataSourceCloudSigma.py
@@ -44,27 +44,25 @@ class DataSourceCloudSigma(sources.DataSource):
def is_running_in_cloudsigma(self):
"""
- Uses dmidecode to detect if this instance of cloud-init is running
+ Uses dmi data to detect if this instance of cloud-init is running
in the CloudSigma's infrastructure.
"""
uname_arch = os.uname()[4]
if uname_arch.startswith("arm") or uname_arch == "aarch64":
- # Disabling because dmidecode in CMD_DMI_SYSTEM crashes kvm process
+ # Disabling because dmi data on ARM processors
LOG.debug("Disabling CloudSigma datasource on arm (LP: #1243287)")
return False
- dmidecode_path = util.which('dmidecode')
- if not dmidecode_path:
+ LOG.debug("determining hypervisor product name via dmi data")
+ sys_product_name = util.read_dmi_data("system-product-name")
+ if not sys_product_name:
+ LOG.warn("failed to get hypervisor product name via dmi data")
return False
+ else:
+ LOG.debug("detected hypervisor as {}".format(sys_product_name))
+ return 'cloudsigma' in sys_product_name.lower()
- LOG.debug("Determining hypervisor product name via dmidecode")
- try:
- cmd = [dmidecode_path, "--string", "system-product-name"]
- system_product_name, _ = util.subp(cmd)
- return 'cloudsigma' in system_product_name.lower()
- except:
- LOG.warn("Failed to get hypervisor product name via dmidecode")
-
+ LOG.warn("failed to query dmi data for system product name")
return False
def get_data(self):