diff options
author | Scott Moser <smoser@brickies.net> | 2020-11-02 15:41:11 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-02 15:41:11 -0500 |
commit | 0af1ff1eaf593c325b4f53181a572110eb016c50 (patch) | |
tree | 2e0dab084dffd4664a6320f15baf374aff008917 /cloudinit/sources/DataSourceEc2.py | |
parent | d619f5171ac0ce5b626ef4575ad5f4468e94c987 (diff) | |
download | vyos-cloud-init-0af1ff1eaf593c325b4f53181a572110eb016c50.tar.gz vyos-cloud-init-0af1ff1eaf593c325b4f53181a572110eb016c50.zip |
cloudinit: move dmi functions out of util (#622)
This just separates the reading of dmi values into its own file.
Some things of note:
* left import of util in dmi.py only for 'is_container'
It'd be good if is_container was not in util.
* just the use of 'util.is_x86' to dmi.py
* open() is used directly rather than load_file.
Diffstat (limited to 'cloudinit/sources/DataSourceEc2.py')
-rw-r--r-- | cloudinit/sources/DataSourceEc2.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/cloudinit/sources/DataSourceEc2.py b/cloudinit/sources/DataSourceEc2.py index 1d09c12a..1930a509 100644 --- a/cloudinit/sources/DataSourceEc2.py +++ b/cloudinit/sources/DataSourceEc2.py @@ -11,6 +11,7 @@ import os import time +from cloudinit import dmi from cloudinit import ec2_utils as ec2 from cloudinit import log as logging from cloudinit import net @@ -699,26 +700,26 @@ def _collect_platform_data(): uuid = util.load_file("/sys/hypervisor/uuid").strip() data['uuid_source'] = 'hypervisor' except Exception: - uuid = util.read_dmi_data('system-uuid') + uuid = dmi.read_dmi_data('system-uuid') data['uuid_source'] = 'dmi' if uuid is None: uuid = '' data['uuid'] = uuid.lower() - serial = util.read_dmi_data('system-serial-number') + serial = dmi.read_dmi_data('system-serial-number') if serial is None: serial = '' data['serial'] = serial.lower() - asset_tag = util.read_dmi_data('chassis-asset-tag') + asset_tag = dmi.read_dmi_data('chassis-asset-tag') if asset_tag is None: asset_tag = '' data['asset_tag'] = asset_tag.lower() - vendor = util.read_dmi_data('system-manufacturer') + vendor = dmi.read_dmi_data('system-manufacturer') data['vendor'] = (vendor if vendor else '').lower() return data |