Skip to content

Commit

Permalink
#3077 Bug fix (#3079)
Browse files Browse the repository at this point in the history
  • Loading branch information
sambodeme authored Dec 22, 2023
1 parent 4216af2 commit a660153
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
Binary file not shown.
7 changes: 3 additions & 4 deletions backend/audit/intakelib/checks/check_cluster_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
from django.conf import settings
from audit.intakelib.intermediate_representation import get_range_by_name
from audit.intakelib.common import get_message, build_cell_error_tuple
from .check_cluster_total import NOT_APPLICABLE, OTHER_CLUSTER, STATE_CLUSTER

logger = logging.getLogger(__name__)

STATE_CLUSTER = "STATE CLUSTER"
OTHER_CLUSTER = "OTHER CLUSTER NOT LISTED ABOVE"


def check_cluster_names(ir):
"""Check that cluster names are valid when present."""
Expand All @@ -29,7 +27,8 @@ def check_cluster_names(ir):

for index, value in enumerate(range_data["values"]):
if value and value not in (
valid_json["cluster_names"] + [STATE_CLUSTER, OTHER_CLUSTER]
valid_json["cluster_names"]
+ [STATE_CLUSTER, OTHER_CLUSTER, NOT_APPLICABLE]
):
errors.append(
build_cell_error_tuple(
Expand Down
1 change: 1 addition & 0 deletions backend/audit/intakelib/checks/check_cluster_total.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

logger = logging.getLogger(__name__)

# A copy of theses constants exists in schema/source/base/Base.libsonnet
STATE_CLUSTER = "STATE CLUSTER"
OTHER_CLUSTER = "OTHER CLUSTER NOT LISTED ABOVE"
NOT_APPLICABLE = "N/A"
Expand Down
3 changes: 1 addition & 2 deletions backend/audit/intakelib/checks/check_other_cluster_names.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import logging
from audit.intakelib.intermediate_representation import get_range_by_name
from audit.intakelib.common import get_message, build_cell_error_tuple
from .check_cluster_total import OTHER_CLUSTER

logger = logging.getLogger(__name__)

OTHER_CLUSTER = "OTHER CLUSTER NOT LISTED ABOVE"


def other_cluster_names(ir):
cluster_name = get_range_by_name(ir, "cluster_name")
Expand Down
3 changes: 1 addition & 2 deletions backend/audit/intakelib/checks/check_state_cluster_names.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import logging
from audit.intakelib.intermediate_representation import get_range_by_name
from audit.intakelib.common import get_message, build_cell_error_tuple
from .check_cluster_total import STATE_CLUSTER

logger = logging.getLogger(__name__)

STATE_CLUSTER = "STATE CLUSTER"


def state_cluster_names(ir):
cluster_name = get_range_by_name(ir, "cluster_name")
Expand Down

0 comments on commit a660153

Please sign in to comment.