Use .get instead of lookup (#2165)

This commit is contained in:
George Pollard
2022-07-15 11:55:30 +12:00
committed by GitHub
parent fe8b75045f
commit 3347e7e67b

View File

@ -133,7 +133,7 @@ class Node(BASE_NODE, ORMMixin):
@classmethod @classmethod
def mark_outdated_nodes(cls) -> None: def mark_outdated_nodes(cls) -> None:
# if outdated agents are allowed, do not attempt to update # if outdated agents are allowed, do not attempt to update
if os.environ["ONEFUZZ_ALLOW_OUTDATED_AGENT"] == "true": if os.environ.get("ONEFUZZ_ALLOW_OUTDATED_AGENT") == "true":
return return
# ony update 500 nodes at a time to mitigate timeout issues # ony update 500 nodes at a time to mitigate timeout issues
@ -268,7 +268,10 @@ class Node(BASE_NODE, ORMMixin):
from .pools import Pool from .pools import Pool
from .scalesets import Scaleset from .scalesets import Scaleset
if self.is_outdated() and os.environ["ONEFUZZ_ALLOW_OUTDATED_AGENT"] != "true": if (
self.is_outdated()
and os.environ.get("ONEFUZZ_ALLOW_OUTDATED_AGENT") != "true"
):
logging.info( logging.info(
"can_process_new_work agent and service versions differ, " "can_process_new_work agent and service versions differ, "
"stopping node. " "stopping node. "