Skip to content

Commit

Permalink
fix: Fixed migration issue with get_feature_status causing migration …
Browse files Browse the repository at this point in the history
…to fail as FeatureFlags wasn't yet added. (#238)
  • Loading branch information
TreyWW committed Mar 30, 2024
1 parent 830d399 commit 8284cee
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions infrastructure/aws/handler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import sys

import boto3
from botocore.config import Config
Expand All @@ -16,17 +17,18 @@

AWS_SCHEDULES_ENABLED = get_var("AWS_SCHEDULES_ACCESS_KEY_ID") and get_var("AWS_SCHEDULES_SECRET_ACCESS_KEY")

if not AWS_SCHEDULES_ENABLED and get_feature_status("isInvoiceSchedulingEnabled", should_use_cache=False):
raise ValueError(
"If using schedules, the variables MUST be set. If you are not going to use schedules, "
"set the isInvoiceSchedulingEnabled feature flag to False"
)
if sys.argv[1] != "migrate":
if not AWS_SCHEDULES_ENABLED and get_feature_status("isInvoiceSchedulingEnabled", should_use_cache=False):
raise ValueError(
"If using schedules, the variables MUST be set. If you are not going to use schedules, "
"set the isInvoiceSchedulingEnabled feature flag to False"
)

if not AWS_SCHEDULES_ENABLED:
try:
FeatureFlags.objects.get(name="isInvoiceSchedulingEnabled").value = False
except FeatureFlags.DoesNotExist:
...
if not AWS_SCHEDULES_ENABLED:
try:
FeatureFlags.objects.get(name="isInvoiceSchedulingEnabled").value = False
except FeatureFlags.DoesNotExist:
...

if AWS_SCHEDULES_ENABLED:
Boto3HandlerSession = boto3.session.Session(
Expand Down

0 comments on commit 8284cee

Please sign in to comment.