Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions keyman/Orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@

sys.path.append("/augur")

conn = redis.Redis.from_url(os.environ.get("REDIS_CONN_STRING"))
# Only create a Redis connection if a connection string is provided.
redis_url = os.environ.get("REDIS_CONN_STRING")
if redis_url:
conn = redis.Redis.from_url(redis_url)
else:
conn = None

# Just log to stdout if we're running in docker
logger = logging.Logger("KeyOrchestrator")
Expand Down Expand Up @@ -151,10 +156,13 @@
WaitKeyTimeout: If no fresh keys available (includes wait duration)
"""
if platform not in self.fresh_keys:
raise InvalidRequest(f"Invalid platform: {platform}")
self.logger.warning(
f"Key requested for uninitialized platform '{platform}'; this may occur during startup after state cleanup."
)
return

if not len(self.fresh_keys[platform]):

Check warning on line 164 in keyman/Orchestrator.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 C1802: Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty (use-implicit-booleaness-not-len) Raw Output: keyman/Orchestrator.py:164:11: C1802: Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty (use-implicit-booleaness-not-len)
if not len(self.expired_keys[platform]):

Check warning on line 165 in keyman/Orchestrator.py

View workflow job for this annotation

GitHub Actions / runner / pylint

[pylint] reported by reviewdog 🐶 C1802: Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty (use-implicit-booleaness-not-len) Raw Output: keyman/Orchestrator.py:165:15: C1802: Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty (use-implicit-booleaness-not-len)
self.logger.warning(f"Key was requested for {platform}, but none are published")
return

Expand Down
Loading