Skip to content

Commit

Permalink
rename platform_helper_config_file -> platform_helper_cache_file
Browse files Browse the repository at this point in the history
  • Loading branch information
DeveloperConnor committed Oct 31, 2024
1 parent 5dd664f commit 408c014
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions dbt_platform_helper/utils/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from jinja2 import Environment
from jinja2 import FileSystemLoader

platform_helper_config_file = ".platform-helper-config.yml"
platform_helper_cache_file = ".platform-helper-config.yml"


def to_yaml(value):
Expand Down Expand Up @@ -110,7 +110,7 @@ def combine_env_data(data):

def read_supported_versions_from_cache(resource_name):

platform_helper_config = read_file_as_yaml(platform_helper_config_file)
platform_helper_config = read_file_as_yaml(platform_helper_cache_file)

return platform_helper_config.get(resource_name).get("versions")

Expand All @@ -119,8 +119,8 @@ def write_to_cache(resource_name, supported_versions):

platform_helper_config = {}

if os.path.exists(platform_helper_config_file):
platform_helper_config = read_file_as_yaml(platform_helper_config_file)
if os.path.exists(platform_helper_cache_file):
platform_helper_config = read_file_as_yaml(platform_helper_cache_file)

cache_dict = {
resource_name: {
Expand All @@ -131,7 +131,7 @@ def write_to_cache(resource_name, supported_versions):

platform_helper_config.update(cache_dict)

with open(platform_helper_config_file, "w") as file:
with open(platform_helper_cache_file, "w") as file:
file.write("# [!] This file is autogenerated via the platform-helper. Do not edit.\n")
yaml.dump(platform_helper_config, file)

Expand All @@ -147,10 +147,10 @@ def cache_refresh_required(resource_name) -> bool:
3. The date-retrieved value of the cached data is > than a time interval. In this case 1 day.
"""

if not os.path.exists(platform_helper_config_file):
if not os.path.exists(platform_helper_cache_file):
return True

platform_helper_config = read_file_as_yaml(platform_helper_config_file)
platform_helper_config = read_file_as_yaml(platform_helper_cache_file)

if platform_helper_config.get(resource_name):
return check_if_cached_datetime_is_greater_than_interval(
Expand Down

0 comments on commit 408c014

Please sign in to comment.