diff options
| author | Scott Moser <smoser@ubuntu.com> | 2015-01-22 12:14:02 -0500 | 
|---|---|---|
| committer | Scott Moser <smoser@ubuntu.com> | 2015-01-22 12:14:02 -0500 | 
| commit | 78915c97c18d678db10e0fde0d9306823c5f4610 (patch) | |
| tree | fa98132617a50bcad3ab9a9e9e962ce1a2263bdd /cloudinit/sources/DataSourceCloudSigma.py | |
| parent | 8d453d2a4da4492857a4487b14fe7b11a014115b (diff) | |
| parent | de32623e6b34e3648958f1a08ef721ed9a03f2f8 (diff) | |
| download | vyos-cloud-init-78915c97c18d678db10e0fde0d9306823c5f4610.tar.gz vyos-cloud-init-78915c97c18d678db10e0fde0d9306823c5f4610.zip  | |
remove dependency on dmidecode on linux
on linux we can read dmi information from /sys rather than using 
dmidecode binary, and thus removing a dependency.
Diffstat (limited to 'cloudinit/sources/DataSourceCloudSigma.py')
| -rw-r--r-- | cloudinit/sources/DataSourceCloudSigma.py | 22 | 
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):  | 
