Skip to content

Commit

Permalink
Constrain os and os.path imports
Browse files Browse the repository at this point in the history
  • Loading branch information
erl-hpe committed Feb 7, 2024
1 parent bb4cd0b commit d8b6315
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
9 changes: 6 additions & 3 deletions vtds_provider_gcp/private/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
"""

import os.path
CONFIG_DIR = os.path.join(os.path.dirname(__file__), "config")
TERRAGRUNT_DIR = os.path.join(os.path.dirname(__file__), "terragrunt")
from os.path import (
join as path_join,
dirname
)
CONFIG_DIR = path_join(dirname(__file__), "config")
TERRAGRUNT_DIR = path_join(dirname(__file__), "terragrunt")
8 changes: 4 additions & 4 deletions vtds_provider_gcp/private/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"""

import os.path
from os.path import join as path_join
import yaml
from vtds_base import ContextualError
from . import CONFIG_DIR
Expand All @@ -47,7 +47,7 @@ def get_base_config(self):
overall vTDS configuration.
"""
config = os.path.join(CONFIG_DIR, "config.yaml")
config = path_join(CONFIG_DIR, "config.yaml")
try:
with open(config, 'r', encoding='UTF-8') as config_stream:
return yaml.safe_load(config_stream)
Expand All @@ -70,7 +70,7 @@ def get_base_config_text(self):
to users.
"""
config = os.path.join(CONFIG_DIR, "config.yaml")
config = path_join(CONFIG_DIR, "config.yaml")
try:
with open(config, 'r', encoding='UTF-8') as config_stream:
return config_stream.read()
Expand All @@ -87,7 +87,7 @@ def get_test_overlay(self):
configurations for testing with this provider layer.
"""
config = os.path.join(CONFIG_DIR, "test_overlay.yaml")
config = path_join(CONFIG_DIR, "test_overlay.yaml")
try:
with open(config, 'r', encoding='UTF-8') as config_stream:
return yaml.safe_load(config_stream)
Expand Down
16 changes: 8 additions & 8 deletions vtds_provider_gcp/private/terragrunt.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"""
# pylint: disable=consider-using-f-string
import shutil
import os.path
from os.path import join as path_join
from os import makedirs
from sys import stdout
import subprocess
Expand Down Expand Up @@ -60,7 +60,7 @@ def initialize(self, config):
configuration to use.
"""
src = os.path.join(TERRAGRUNT_DIR, "framework")
src = path_join(TERRAGRUNT_DIR, "framework")
dst = "terragrunt"
self.add_subtree(src, dst)

Expand All @@ -70,12 +70,12 @@ def __run__(self, subdir, operation, tag, timeout=None):
error logs for later analysis.
"""
directory = os.path.join(self.build_dir, subdir)
logs = os.path.join(self.build_dir, "logs")
err_path = os.path.join(
directory = path_join(self.build_dir, subdir)
logs = path_join(self.build_dir, "logs")
err_path = path_join(
logs,
"terragrunt_%s[%s]-err.txt" % (operation, tag))
out_path = os.path.join(
out_path = path_join(
logs,
"terragrunt_%s[%s]-out.txt" % (operation, tag))
try:
Expand Down Expand Up @@ -176,7 +176,7 @@ def dismantle(self):
supporting resources.
"""
path = os.path.join(
path = path_join(
"terragrunt",
"system",
"platform",
Expand All @@ -191,7 +191,7 @@ def restore(self):
resources.
"""
path = os.path.join(
path = path_join(
"terragrunt",
"system",
"platform",
Expand Down

0 comments on commit d8b6315

Please sign in to comment.