Skip to content

Commit

Permalink
[SC-71155] Fix TypeError in Pipelines CLI (#361)
Browse files Browse the repository at this point in the history
We were indexing by key into a string instead of a dict.
  • Loading branch information
jon-mio authored Feb 25, 2021
1 parent d531726 commit 460d388
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions databricks_cli/pipelines/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ def deploy_cli(api_client, spec_arg, spec, allow_duplicate_names, pipeline_id):
if (pipeline_id and 'id' in spec_obj) and pipeline_id != spec_obj["id"]:
raise ValueError(
"The ID provided in --pipeline_id '{}' is different from the id provided "
"the spec '{}'. Please resolve the conflict and try the command again. "
"in the spec '{}'. Please resolve the conflict and try the command again. "
"Because pipeline IDs are no longer persisted after being deleted, we "
"recommend removing the ID field from your spec."
.format(pipeline_id, spec["id"])
.format(pipeline_id, spec_obj["id"])
)

spec_obj['id'] = pipeline_id or spec_obj.get('id', None)
Expand Down
2 changes: 2 additions & 0 deletions tests/pipelines/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,4 +307,6 @@ def test_deploy_pipeline_conflicting_ids(pipelines_api_mock, tmpdir):

result = CliRunner().invoke(cli.deploy_cli, ['--spec', path, '--pipeline-id', "fake"])
assert result.exit_code == 1
assert "ValueError: The ID provided in --pipeline_id 'fake' is different from the id " \
"provided in the spec '123'." in result.stdout
assert pipelines_api_mock.deploy.call_count == 0

0 comments on commit 460d388

Please sign in to comment.