Skip to content

Commit

Permalink
Remove tag mapping unleash flag (#5401)
Browse files Browse the repository at this point in the history
  • Loading branch information
myersCody authored Nov 27, 2024
1 parent 452ea23 commit ca00e0d
Show file tree
Hide file tree
Showing 11 changed files with 8 additions and 53 deletions.
5 changes: 0 additions & 5 deletions koku/masu/database/aws_report_db_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from masu.database import AWS_CUR_TABLE_MAP
from masu.database import OCP_REPORT_TABLE_MAP
from masu.database.report_db_accessor_base import ReportDBAccessorBase
from masu.processor import is_feature_cost_3592_tag_mapping_enabled
from masu.processor import is_feature_unattributed_storage_enabled_aws
from reporting.models import OCP_ON_ALL_PERSPECTIVES
from reporting.models import OCP_ON_AWS_PERSPECTIVES
Expand Down Expand Up @@ -299,8 +298,6 @@ def populate_ocp_on_aws_tag_information(self, bill_ids, start_date, end_date, re
sql = sql.decode("utf-8")
self._prepare_and_execute_raw_sql_query(self._table_map["ocp_on_aws_tags_summary"], sql, sql_params)
# Tag Mapping
if not is_feature_cost_3592_tag_mapping_enabled(self.schema):
return
with schema_context(self.schema):
# Early return check to see if they have any tag mappings set.
if not TagMapping.objects.filter(
Expand Down Expand Up @@ -359,8 +356,6 @@ def update_line_item_daily_summary_with_tag_mapping(self, start_date, end_date,
Returns:
(None)
"""
if not is_feature_cost_3592_tag_mapping_enabled(self.schema):
return
with schema_context(self.schema):
# Early return check to see if they have any tag mappings set.
if not TagMapping.objects.filter(child__provider_type=Provider.PROVIDER_AWS).exists():
Expand Down
5 changes: 0 additions & 5 deletions koku/masu/database/azure_report_db_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from masu.database import AZURE_REPORT_TABLE_MAP
from masu.database import OCP_REPORT_TABLE_MAP
from masu.database.report_db_accessor_base import ReportDBAccessorBase
from masu.processor import is_feature_cost_3592_tag_mapping_enabled
from masu.processor import is_feature_unattributed_storage_enabled_azure
from reporting.models import OCP_ON_ALL_PERSPECTIVES
from reporting.models import OCP_ON_AZURE_PERSPECTIVES
Expand Down Expand Up @@ -167,8 +166,6 @@ def populate_ocp_on_azure_tag_information(self, bill_ids, start_date, end_date,
sql = sql.decode("utf-8")
self._prepare_and_execute_raw_sql_query(self._table_map["ocp_on_azure_tags_summary"], sql, sql_params)
# Tag Mapping
if not is_feature_cost_3592_tag_mapping_enabled(self.schema):
return
with schema_context(self.schema):
# Early return check to see if they have any tag mappings set.
if not TagMapping.objects.filter(
Expand Down Expand Up @@ -321,8 +318,6 @@ def update_line_item_daily_summary_with_tag_mapping(self, start_date, end_date,
Returns:
(None)
"""
if not is_feature_cost_3592_tag_mapping_enabled(self.schema):
return
with schema_context(self.schema):
# Early return check to see if they have any tag mappings set.
if not TagMapping.objects.filter(child__provider_type=Provider.PROVIDER_AZURE).exists():
Expand Down
5 changes: 0 additions & 5 deletions koku/masu/database/gcp_report_db_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from masu.database import GCP_REPORT_TABLE_MAP
from masu.database import OCP_REPORT_TABLE_MAP
from masu.database.report_db_accessor_base import ReportDBAccessorBase
from masu.processor import is_feature_cost_3592_tag_mapping_enabled
from masu.util.gcp.common import check_resource_level
from masu.util.ocp.common import get_cluster_alias_from_cluster_id
from reporting.models import OCP_ON_GCP_TEMP_MANAGED_TABLES
Expand Down Expand Up @@ -495,8 +494,6 @@ def populate_ocp_on_gcp_tag_information(self, gcp_bill_ids, start_date, end_date
sql = sql.decode("utf-8")
self._prepare_and_execute_raw_sql_query(self._table_map["ocp_on_gcp_tags_summary"], sql, sql_params)
# Tag Mapping
if not is_feature_cost_3592_tag_mapping_enabled(self.schema):
return
with schema_context(self.schema):
# Early return check to see if they have any tag mappings set.
if not TagMapping.objects.filter(
Expand All @@ -519,8 +516,6 @@ def update_line_item_daily_summary_with_tag_mapping(self, start_date, end_date,
Returns:
(None)
"""
if not is_feature_cost_3592_tag_mapping_enabled(self.schema):
return
with schema_context(self.schema):
# Early return check to see if they have any tag mappings set.
if not TagMapping.objects.filter(child__provider_type=Provider.PROVIDER_GCP).exists():
Expand Down
3 changes: 0 additions & 3 deletions koku/masu/database/oci_report_db_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from koku.database import SQLScriptAtomicExecutorMixin
from masu.database import OCI_CUR_TABLE_MAP
from masu.database.report_db_accessor_base import ReportDBAccessorBase
from masu.processor import is_feature_cost_3592_tag_mapping_enabled
from reporting.provider.all.models import TagMapping
from reporting.provider.oci.models import OCICostEntryBill
from reporting.provider.oci.models import OCICostEntryLineItemDailySummary
Expand Down Expand Up @@ -133,8 +132,6 @@ def update_line_item_daily_summary_with_tag_mapping(self, start_date, end_date,
Returns:
(None)
"""
if not is_feature_cost_3592_tag_mapping_enabled(self.schema):
return
with schema_context(self.schema):
# Early return check to see if they have any tag mappings set.
if not TagMapping.objects.filter(child__provider_type=Provider.PROVIDER_OCI).exists():
Expand Down
3 changes: 0 additions & 3 deletions koku/masu/database/ocp_report_db_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
from koku.trino_database import TrinoStatementExecError
from masu.database import OCP_REPORT_TABLE_MAP
from masu.database.report_db_accessor_base import ReportDBAccessorBase
from masu.processor import is_feature_cost_3592_tag_mapping_enabled
from masu.util.common import filter_dictionary
from masu.util.common import trino_table_exists
from masu.util.gcp.common import check_resource_level
Expand Down Expand Up @@ -106,8 +105,6 @@ def update_line_item_daily_summary_with_tag_mapping(self, start_date, end_date,
Returns
(None)
"""
if not is_feature_cost_3592_tag_mapping_enabled(self.schema):
return
with schema_context(self.schema):
# Early return check to see if they have any tag mappings set.
if not TagMapping.objects.filter(child__provider_type=Provider.PROVIDER_OCP).exists():
Expand Down
8 changes: 0 additions & 8 deletions koku/masu/processor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,6 @@ def is_feature_unattributed_storage_enabled_aws(account):
return UNLEASH_CLIENT.is_enabled(unleash_flag, context, fallback_development_true)


def is_feature_cost_3592_tag_mapping_enabled(account):
"""Should tag mapping be enabled."""
unleash_flag = "cost-management.backend.feature-cost-3592-tag-mapping"
account = convert_account(account)
context = {"schema": account}
return UNLEASH_CLIENT.is_enabled(unleash_flag, context, fallback_development_true)


def is_feature_cost_4403_ec2_compute_cost_enabled(account): # pragma: no cover
"""Should EC2 individual VM compute cost be enabled."""
unleash_flag = "cost-management.backend.feature-4403-enable-ec2-compute-processing"
Expand Down
8 changes: 2 additions & 6 deletions koku/masu/test/database/test_aws_report_db_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,13 +408,11 @@ def test_delete_aws_hive_partition_by_month(self, mock_trino, mock_table_exist):
mock_trino.assert_not_called()
mock_table_exist.assert_not_called()

@patch("masu.database.aws_report_db_accessor.is_feature_cost_3592_tag_mapping_enabled")
def test_update_line_item_daily_summary_with_tag_mapping(self, mock_unleash):
def test_update_line_item_daily_summary_with_tag_mapping(self):
"""
Test that mapped tags are updated in aws line item summary tables.
After the update, the child tag's key-value data is cleared and the parent tag's data is updated accordingly.
"""
mock_unleash.return_value = True
populated_keys = []

table_classes = [AWSCostEntryLineItemDailySummary, AWSCostEntryLineItemSummaryByEC2ComputeP]
Expand Down Expand Up @@ -459,12 +457,10 @@ def test_update_line_item_daily_summary_with_tag_mapping(self, mock_unleash):
# Clear TagMapping objects
TagMapping.objects.filter(parent=parent_obj, child=child_obj).delete()

@patch("masu.database.aws_report_db_accessor.is_feature_cost_3592_tag_mapping_enabled")
def test_populate_ocp_on_aws_tag_information(self, mock_unleash):
def test_populate_ocp_on_aws_tag_information(self):
"""
This tests the tag mapping feature.
"""
mock_unleash.return_value = True
populated_keys = []
report_period_id = 1
with schema_context(self.schema):
Expand Down
8 changes: 2 additions & 6 deletions koku/masu/test/database/test_azure_report_db_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,10 @@ def test_delete_ocp_on_azure_hive_partition_by_day_managed_table(
mock_connect.assert_called()
self.assertEqual(mock_connect.call_count, settings.HIVE_PARTITION_DELETE_RETRIES)

@patch("masu.database.azure_report_db_accessor.is_feature_cost_3592_tag_mapping_enabled")
def test_update_line_item_daily_summary_with_tag_mapping(self, mock_unleash):
def test_update_line_item_daily_summary_with_tag_mapping(self):
"""
This tests the tag mapping feature.
"""
mock_unleash.return_value = True
populated_keys = []
with schema_context(self.schema):
enabled_tags = EnabledTagKeys.objects.filter(provider_type=Provider.PROVIDER_AZURE, enabled=True)
Expand Down Expand Up @@ -382,12 +380,10 @@ def test_update_line_item_daily_summary_with_tag_mapping(self, mock_unleash):
).count()
self.assertEqual(0, actual_child_count)

@patch("masu.database.azure_report_db_accessor.is_feature_cost_3592_tag_mapping_enabled")
def test_populate_ocp_on_azure_tag_information(self, mock_unleash):
def test_populate_ocp_on_azure_tag_information(self):
"""
This tests the tag mapping feature.
"""
mock_unleash.return_value = True
populated_keys = []
report_period_id = 1
with schema_context(self.schema):
Expand Down
8 changes: 2 additions & 6 deletions koku/masu/test/database/test_gcp_report_db_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,12 +494,10 @@ def test_delete_ocp_on_gcp_hive_partition_by_day_managed_table(
mock_connect.assert_called()
self.assertEqual(mock_connect.call_count, settings.HIVE_PARTITION_DELETE_RETRIES)

@patch("masu.database.gcp_report_db_accessor.is_feature_cost_3592_tag_mapping_enabled")
def test_update_line_item_daily_summary_with_tag_mapping(self, mock_unleash):
def test_update_line_item_daily_summary_with_tag_mapping(self):
"""
This tests the tag mapping feature.
"""
mock_unleash.return_value = True
populated_keys = []
with schema_context(self.schema):
enabled_tags = EnabledTagKeys.objects.filter(provider_type=Provider.PROVIDER_GCP, enabled=True)
Expand Down Expand Up @@ -528,12 +526,10 @@ def test_update_line_item_daily_summary_with_tag_mapping(self, mock_unleash):
).count()
self.assertEqual(0, actual_child_count)

@patch("masu.database.gcp_report_db_accessor.is_feature_cost_3592_tag_mapping_enabled")
def test_populate_ocp_on_gcp_tag_information(self, mock_unleash):
def test_populate_ocp_on_gcp_tag_information(self):
"""
This tests the tag mapping feature.
"""
mock_unleash.return_value = True
populated_keys = []
report_period_id = 1
with schema_context(self.schema):
Expand Down
4 changes: 1 addition & 3 deletions koku/masu/test/database/test_oci_report_db_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,10 @@ def test_table_properties(self):
def test_table_map(self):
self.assertEqual(self.accessor._table_map, OCI_CUR_TABLE_MAP)

@patch("masu.database.oci_report_db_accessor.is_feature_cost_3592_tag_mapping_enabled")
def test_update_line_item_daily_summary_with_tag_mapping(self, mock_unleash):
def test_update_line_item_daily_summary_with_tag_mapping(self):
"""
This tests the tag mapping feature.
"""
mock_unleash.return_value = True
populated_keys = []
with schema_context(self.schema):
enabled_tags = EnabledTagKeys.objects.filter(provider_type=Provider.PROVIDER_OCI, enabled=True)
Expand Down
4 changes: 1 addition & 3 deletions koku/masu/test/database/test_ocp_report_db_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1027,12 +1027,10 @@ def get_pkgutil_values(file):
mock_sql_execute.assert_called()
self.assertEqual(len(mock_sql_execute.call_args_list), 4)

@patch("masu.database.ocp_report_db_accessor.is_feature_cost_3592_tag_mapping_enabled")
def test_update_line_item_daily_summary_with_tag_mapping(self, mock_unleash):
def test_update_line_item_daily_summary_with_tag_mapping(self):
"""
This tests the tag mapping feature.
"""
mock_unleash.return_value = True
populated_keys = []
with schema_context(self.schema):
enabled_tags = EnabledTagKeys.objects.filter(provider_type=Provider.PROVIDER_OCP, enabled=True)
Expand Down

0 comments on commit ca00e0d

Please sign in to comment.