Skip to content

Commit 7c675c8

Browse files
authored
Merge pull request #145 from dbt-labs/fix-unlink-config-file
2 parents 352dbd2 + c168d10 commit 7c675c8

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/dbt_jobs_as_code/main.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,13 +507,15 @@ def unlink(
507507
All relevant jobs get the part [[...]] removed from their name
508508
"""
509509

510+
defined_jobs = None
510511
# we get the account id either from a parameter (e.g if the config file doesn't exist) or from the config file
511512
if account_id:
512513
cloud_account_id = account_id
513514
elif config:
514515
# we get the account id from the config file
515-
defined_jobs = load_job_configuration(config, None).jobs.values()
516-
cloud_account_id = list(defined_jobs)[0].account_id
516+
config_files, _ = resolve_file_paths(config, None)
517+
defined_jobs = load_job_configuration(config_files, None).jobs
518+
cloud_account_id = list(defined_jobs.values())[0].account_id
517519
else:
518520
raise click.BadParameter("Either --config or --account-id must be provided")
519521

@@ -534,6 +536,8 @@ def unlink(
534536
selected_jobs = [job for job in selected_jobs if job.environment_id in environment_id]
535537
if identifier:
536538
selected_jobs = [job for job in selected_jobs if job.identifier in identifier]
539+
if defined_jobs:
540+
selected_jobs = [job for job in selected_jobs if job.identifier in defined_jobs]
537541

538542
for cloud_job in selected_jobs:
539543
current_identifier = cloud_job.identifier

0 commit comments

Comments
 (0)