Fix UnboundLocalError when no enclosures present
This commit is contained in:
@@ -43,6 +43,8 @@ async def get_overview(response: Response):
|
|||||||
warnings = 0
|
warnings = 0
|
||||||
errors = 0
|
errors = 0
|
||||||
all_healthy = True
|
all_healthy = True
|
||||||
|
all_cache_hits = True
|
||||||
|
any_lookups = False
|
||||||
|
|
||||||
for enc_idx, enc in enumerate(enclosures_raw):
|
for enc_idx, enc in enumerate(enclosures_raw):
|
||||||
slots_raw = list_slots(enc["id"])
|
slots_raw = list_slots(enc["id"])
|
||||||
@@ -53,8 +55,6 @@ async def get_overview(response: Response):
|
|||||||
smart_results = await asyncio.gather(*smart_tasks, return_exceptions=True)
|
smart_results = await asyncio.gather(*smart_tasks, return_exceptions=True)
|
||||||
|
|
||||||
smart_map: dict[str, dict] = {}
|
smart_map: dict[str, dict] = {}
|
||||||
all_cache_hits = True
|
|
||||||
any_lookups = False
|
|
||||||
for (slot_info, dev), result in zip(populated, smart_results):
|
for (slot_info, dev), result in zip(populated, smart_results):
|
||||||
if isinstance(result, Exception):
|
if isinstance(result, Exception):
|
||||||
logger.warning("SMART query failed for %s: %s", dev, result)
|
logger.warning("SMART query failed for %s: %s", dev, result)
|
||||||
|
|||||||
Reference in New Issue
Block a user