Skip to content

Commit

Permalink
Call the self.stored_tools only once to be extra safe from side-effects
Browse files Browse the repository at this point in the history
  • Loading branch information
aieri committed Dec 12, 2024
1 parent 856f33c commit 46fa722
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ def __init__(self, *args: Any) -> None:
def exporters(self) -> List[BaseExporter]:
"""Return list of exporters based on detected hardware."""
exporters: List[BaseExporter] = []
if self.stored_tools & HardwareExporter.hw_tools():
stored_tools = self.stored_tools
if stored_tools & HardwareExporter.hw_tools():
exporters.append(
HardwareExporter(
self.charm_dir,
Expand All @@ -79,10 +80,10 @@ def exporters(self) -> List[BaseExporter]:
)
)

if self.stored_tools & SmartCtlExporter.hw_tools():
if stored_tools & SmartCtlExporter.hw_tools():
exporters.append(SmartCtlExporter(self.model.config))

if self.stored_tools & DCGMExporter.hw_tools():
if stored_tools & DCGMExporter.hw_tools():
exporters.append(DCGMExporter(self.model.config))

return exporters
Expand Down

0 comments on commit 46fa722

Please sign in to comment.