Skip to content

Commit

Permalink
hwbench: generic vendor: make monitoring file optional
Browse files Browse the repository at this point in the history
Since we moved to the generic vendor, we no longer use the mockedvendor
by default (it's now only for tests). So when running hwbench on a
desktop/laptop for local testing, it requires setting the monitoring
file, which wasn't the case before.

This change makes the monitoring file optional in this case, with a
fallback when it is not provided to the MockedBMC.
  • Loading branch information
anisse committed Nov 29, 2024
1 parent 7cc8021 commit 0e8da7c
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions hwbench/environment/vendors/generic.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from .vendor import Vendor, BMC
from .vendor import Vendor
from .mock import MockedBMC


class GenericVendor(Vendor):
Expand All @@ -9,11 +10,16 @@ def __init__(
monitoring_config_filename,
):
super().__init__(out_dir, dmi, monitoring_config_filename)
self.bmc = BMC(self.out_dir, self)

def detect(self) -> bool:
return True

def prepare(self):
if self.get_monitoring_config_filename():
super().prepare()
else:
self.bmc = MockedBMC(self.out_dir, self)

def save_bios_config(self):
print("Warning: using Generic BIOS vendor")
# TODO: in the future, dump available BIOS config via redfish
Expand All @@ -28,3 +34,12 @@ def save_bmc_config(self):

def name(self) -> str:
return "GenericVendor"

def find_monitoring_sections(
self, section_type: str, sections_list=[], max_sections=0
):
if self.get_monitoring_config_filename():
return super().find_monitoring_sections(
section_type, sections_list, max_sections
)
return []

0 comments on commit 0e8da7c

Please sign in to comment.