Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions lisa/sut_orchestrator/aws/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,11 @@ def _initialize(self, *args: Any, **kwargs: Any) -> None:
self._initialize_information(self._node)

def _get_primary(self, nics: List[Any]) -> Any:
found_primary = False
for nic in nics:
if nic["Attachment"]["DeviceIndex"] == 0:
found_primary = True
break
if not found_primary:
raise LisaException(f"fail to find primary nic for vm {self._node.name}")
return nic
return nic

raise LisaException(f"failed to find primary nic for vm {self._node.name}")

def switch_sriov(
self, enable: bool, wait: bool = True, reset_connections: bool = True
Expand Down
9 changes: 3 additions & 6 deletions lisa/sut_orchestrator/azure/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,14 +793,11 @@ def _check_sriov_enabled(
def _get_primary(
self, nics: List[NetworkInterfaceReference]
) -> NetworkInterfaceReference:
found_primary = False
for nic in nics:
if nic.primary:
found_primary = True
break
if not found_primary:
raise LisaException(f"fail to find primary nic for vm {self._node.name}")
return nic
return nic

raise LisaException(f"failed to find primary nic for vm {self._node.name}")

def _get_all_nics(self) -> Any:
azure_platform: AzurePlatform = self._platform # type: ignore
Expand Down
2 changes: 1 addition & 1 deletion lisa/tools/tar.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def is_top_level(tar_content: str) -> bool:
# if we need to test anything, add inputs that pass all tests
if filters:
for item in content:
if all(map(lambda x: x(item), filters)): # noqa: B023
if all(func(item) for func in filters):
output.append(item)
return output
else:
Expand Down
3 changes: 0 additions & 3 deletions pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ disable=
# Potential bugs
abstract-method,
broad-except,
cell-var-from-loop,
cyclic-import,
eval-used,
expression-not-assigned,
Expand All @@ -52,10 +51,8 @@ disable=
redefined-outer-name,
super-init-not-called,
unbalanced-tuple-unpacking,
undefined-loop-variable,
unspecified-encoding,
unsubscriptable-object,
used-before-assignment,

# Syntax / Logic
chained-comparison,
Expand Down
4 changes: 2 additions & 2 deletions selftests/test_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@ def test_create_from_runbook_cap(self) -> None:
for n in env.nodes.list():
# mock initializing
n._is_initialized = True
self.assertEqual(search_space.IntRange(min=4), n.capability.core_count)
self.assertEqual(search_space.IntRange(min=4), n.capability.core_count)
self.assertIsNone(n.capability.disk)

self.assertIsNone(n.capability.disk)
# check from env capability
env_cap = env.capability
self.assertEqual(1, len(env_cap.nodes))
Expand Down