mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Fix unnecessary warning for ip bans.yaml (#6417)
This commit is contained in:
parent
e8a22cb4a8
commit
10bf659773
@ -4,6 +4,7 @@ from collections import defaultdict
|
||||
from datetime import datetime
|
||||
from ipaddress import ip_address
|
||||
import logging
|
||||
import os
|
||||
|
||||
from aiohttp.web_exceptions import HTTPForbidden, HTTPUnauthorized
|
||||
import voluptuous as vol
|
||||
@ -115,13 +116,14 @@ def load_ip_bans_config(path: str):
|
||||
"""Loading list of banned IPs from config file."""
|
||||
ip_list = []
|
||||
|
||||
if not os.path.isfile(path):
|
||||
return ip_list
|
||||
|
||||
try:
|
||||
list_ = load_yaml_config_file(path)
|
||||
except FileNotFoundError:
|
||||
return []
|
||||
except HomeAssistantError as err:
|
||||
_LOGGER.error('Unable to load %s: %s', path, str(err))
|
||||
return []
|
||||
return ip_list
|
||||
|
||||
for ip_ban, ip_info in list_.items():
|
||||
try:
|
||||
|
Loading…
x
Reference in New Issue
Block a user