Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions core/dbt/cli/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
from dbt.helper_types import WarnErrorOptions
from dbt.config.project import PartialProject
from dbt.exceptions import DbtProjectError
from dbt.cli.resolvers import default_project_dir
from pathlib import Path

if os.name != "nt":
# https://bugs.python.org/issue41567
Expand Down Expand Up @@ -132,8 +134,8 @@ def assign_params(ctx, params_assigned_from_default):

# Default LOG_PATH from PROJECT_DIR, if available.
if getattr(self, "LOG_PATH", None) is None:
project_dir = getattr(self, "PROJECT_DIR", default_project_dir())
log_path = "logs"
project_dir = getattr(self, "PROJECT_DIR", None)
# If available, set LOG_PATH from log-path in dbt_project.yml
# Known limitations:
# 1. Using PartialProject here, so no jinja rendering of log-path.
Expand All @@ -147,8 +149,8 @@ def assign_params(ctx, params_assigned_from_default):
log_path = str(partial.project_dict.get("log-path", log_path))
except DbtProjectError:
pass

object.__setattr__(self, "LOG_PATH", log_path)
# TODO should concatenation go here or on line 138?
object.__setattr__(self, "LOG_PATH", Path(project_dir) / log_path)

# Support console DO NOT TRACK initiave
object.__setattr__(
Expand Down
Binary file modified core/dbt/docs/build/doctrees/environment.pickle
Binary file not shown.
5 changes: 2 additions & 3 deletions core/dbt/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,10 @@ def set_from_args(args: Namespace, user_config):

# make a dummy context to get the flags, totally arbitrary
ctx = cli.make_context("run", ["run"])
flags = Flags(ctx, user_config)
for arg_name, args_param_value in vars(args).items():
args_param_value = convert_config(arg_name, args_param_value)
object.__setattr__(flags, arg_name.upper(), args_param_value)
object.__setattr__(flags, arg_name.lower(), args_param_value)
ctx.params[arg_name.lower()] = args_param_value
flags = Flags(ctx, user_config)
GLOBAL_FLAGS = flags # type: ignore


Expand Down
4 changes: 2 additions & 2 deletions core/dbt/tests/fixtures/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@ def project_files(project_root, models, macros, snapshots, properties, seeds, te

# We have a separate logs dir for every test
@pytest.fixture(scope="class")
def logs_dir(request, prefix):
return os.path.join(request.config.rootdir, "logs", prefix)
def logs_dir(request, prefix, project_root):
return os.path.join(project_root, "logs")


# This fixture is for customizing tests that need overrides in adapter
Expand Down
8 changes: 4 additions & 4 deletions tests/functional/partial_parsing/test_pp_vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,18 +317,18 @@ def dbt_profile_target(self):
"dbname": "dbt",
}

def test_profile_env_vars(self, project):
def test_profile_env_vars(self, project, monkeypatch):

# Initial run
os.environ["ENV_VAR_USER"] = "root"
os.environ["ENV_VAR_PASS"] = "password"
monkeypatch.setenv("ENV_VAR_USER", "root")
monkeypatch.setenv("ENV_VAR_PASS", "password")

run_dbt(["run"])
manifest = get_manifest(project.project_root)
env_vars_checksum = manifest.state_check.profile_env_vars_hash.checksum

# Change env_vars, the user doesn't exist, this should fail
os.environ["ENV_VAR_USER"] = "fake_user"
monkeypatch.setenv("ENV_VAR_USER", "fake_user")

# N.B. run_dbt_and_capture won't work here because FailedToConnectError ends the test entirely
with pytest.raises(FailedToConnectError):
Expand Down