From 3347e7e67b3c51dddf47eafc9320cfbc7bd609ae Mon Sep 17 00:00:00 2001 From: George Pollard Date: Fri, 15 Jul 2022 11:55:30 +1200 Subject: [PATCH] Use .get instead of lookup (#2165) --- src/api-service/__app__/onefuzzlib/workers/nodes.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/api-service/__app__/onefuzzlib/workers/nodes.py b/src/api-service/__app__/onefuzzlib/workers/nodes.py index fcc232f88..7570eaf05 100644 --- a/src/api-service/__app__/onefuzzlib/workers/nodes.py +++ b/src/api-service/__app__/onefuzzlib/workers/nodes.py @@ -133,7 +133,7 @@ class Node(BASE_NODE, ORMMixin): @classmethod def mark_outdated_nodes(cls) -> None: # 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 # 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 .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( "can_process_new_work agent and service versions differ, " "stopping node. "