|
5 | 5 |
|
6 | 6 | from lisa.base_tools import Cat |
7 | 7 | from lisa.executable import Tool |
8 | | -from lisa.operating_system import Debian, Fedora, Redhat, Suse |
| 8 | +from lisa.operating_system import CBLMariner, Debian, Fedora, Redhat, Suse |
9 | 9 | from lisa.util import LisaException, UnsupportedDistroException, find_group_in_lines |
10 | 10 |
|
11 | 11 | from .ls import Ls |
@@ -71,10 +71,32 @@ def get_timeout(self) -> int: |
71 | 71 | if group and not group["default"]: |
72 | 72 | value = int(group["number"]) |
73 | 73 | is_default_value = False |
74 | | - elif isinstance(self.node.os, Fedora): |
75 | | - # the default value in fedora is 300 |
| 74 | + elif isinstance(self.node.os, (Fedora, CBLMariner)): |
| 75 | + # Fedora and AZL4+ use NetworkManager for DHCP; default timeout is 300. |
| 76 | + # CBLMariner < 4 is not supported here and raises below. |
| 77 | + if isinstance(self.node.os, CBLMariner) and ( |
| 78 | + self.node.os.information.version.major < 4 |
| 79 | + ): |
| 80 | + raise UnsupportedDistroException( |
| 81 | + os=self.node.os, |
| 82 | + message=( |
| 83 | + "CBLMariner < 4 (AZL2/3) uses dhcpcd rather than " |
| 84 | + "NetworkManager, so this NetworkManager-based timeout " |
| 85 | + "lookup does not apply. To add support, read the timeout " |
| 86 | + "from the dhcpcd configuration (e.g. /etc/dhcpcd.conf) " |
| 87 | + "instead." |
| 88 | + ), |
| 89 | + ) |
76 | 90 | value = 300 |
77 | | - result = self.node.execute("NetworkManager --print-config", sudo=True) |
| 91 | + result = self.node.execute( |
| 92 | + "NetworkManager --print-config", |
| 93 | + sudo=True, |
| 94 | + expected_exit_code=0, |
| 95 | + expected_exit_code_failure_message=( |
| 96 | + "Failed to read DHCP timeout from NetworkManager. " |
| 97 | + "Ensure NetworkManager is installed and accessible." |
| 98 | + ), |
| 99 | + ) |
78 | 100 | group = find_group_in_lines(result.stdout, self._fedora_pattern) |
79 | 101 | if group and value != int(group["number"]): |
80 | 102 | value = int(group["number"]) |
|
0 commit comments