bug: handle OSError as ConnectionError, and handle Vnish Msg bug because of missing id key.
This commit is contained in:
@@ -257,6 +257,12 @@ If you are sure you want to use this command please use API.send_command("{comma
|
|||||||
# this is an error
|
# this is an error
|
||||||
return False, f"{key}: " + data[key][0]["STATUS"][0]["Msg"]
|
return False, f"{key}: " + data[key][0]["STATUS"][0]["Msg"]
|
||||||
elif "id" not in data.keys():
|
elif "id" not in data.keys():
|
||||||
|
if isinstance(data["STATUS"], list):
|
||||||
|
if data["STATUS"][0].get("STATUS", None) in ["S", "I"]:
|
||||||
|
return True, None
|
||||||
|
else:
|
||||||
|
return False, data["STATUS"][0]["Msg"]
|
||||||
|
|
||||||
if data["STATUS"] not in ["S", "I"]:
|
if data["STATUS"] not in ["S", "I"]:
|
||||||
return False, data["Msg"]
|
return False, data["Msg"]
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -194,8 +194,8 @@ async def ping_and_get_miner(
|
|||||||
except asyncio.exceptions.TimeoutError:
|
except asyncio.exceptions.TimeoutError:
|
||||||
# ping failed if we time out
|
# ping failed if we time out
|
||||||
continue
|
continue
|
||||||
except ConnectionRefusedError:
|
except OSError as e:
|
||||||
raise
|
raise ConnectionRefusedError from e
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.warning(f"{str(ip)}: Unhandled ping exception: {e}")
|
logging.warning(f"{str(ip)}: Unhandled ping exception: {e}")
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user