diff options
author | Alberto Contreras <alberto.contreras@canonical.com> | 2022-06-08 20:16:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-08 13:16:34 -0500 |
commit | 6270b500535423d6a58c487c4a1e51d1c3dae5ac (patch) | |
tree | 26c42bfc01da6c75dd4d969f2f4725f070f03d80 /cloudinit/dmi.py | |
parent | a703ee886feaf0aa8971052a3b4b308d8eae8bb2 (diff) | |
download | cloud-init-git-6270b500535423d6a58c487c4a1e51d1c3dae5ac.tar.gz |
Oracle ds changes (#1474)
For primary network config:
- Use `iSCSI` config if some `/run/net*` file exists, even if
`/run/initramfs/open-iscsi.interface` does not.
- If the instance is not an `iSCSI` one, then crawl the network
config from `IMDS` instead of falling back to "best guess".
- Remove unnecessary conditional use of dhcp.EphemeralDHCPv4
and use it always to crawl `IMDS`.
- Migrate tests to pytest.
- Extend unit test coverage.
- Add some types for mypy.
LP: #1967942
Diffstat (limited to 'cloudinit/dmi.py')
-rw-r--r-- | cloudinit/dmi.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/cloudinit/dmi.py b/cloudinit/dmi.py index 23ca047e..dff9ab0f 100644 --- a/cloudinit/dmi.py +++ b/cloudinit/dmi.py @@ -1,6 +1,7 @@ # This file is part of cloud-init. See LICENSE file for license information. import os from collections import namedtuple +from typing import Optional from cloudinit import log as logging from cloudinit import subp @@ -58,7 +59,7 @@ DMIDECODE_TO_KERNEL = { } -def _read_dmi_syspath(key): +def _read_dmi_syspath(key: str) -> Optional[str]: """ Reads dmi data from /sys/class/dmi/id """ @@ -96,7 +97,7 @@ def _read_dmi_syspath(key): return None -def _read_kenv(key): +def _read_kenv(key: str) -> Optional[str]: """ Reads dmi data from FreeBSD's kenv(1) """ @@ -114,12 +115,11 @@ def _read_kenv(key): return result except subp.ProcessExecutionError as e: LOG.debug("failed kenv cmd: %s\n%s", cmd, e) - return None return None -def _call_dmidecode(key, dmidecode_path): +def _call_dmidecode(key: str, dmidecode_path: str) -> Optional[str]: """ Calls out to dmidecode to get the data out. This is mostly for supporting OS's without /sys/class/dmi/id support. @@ -137,7 +137,7 @@ def _call_dmidecode(key, dmidecode_path): return None -def read_dmi_data(key): +def read_dmi_data(key: str) -> Optional[str]: """ Wrapper for reading DMI data. |