Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnester committed Sep 10, 2024
1 parent 997d4ad commit b7ea53d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions bundle/config/mutator/rewrite_workspace_prefix.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ func (m *rewriteWorkspacePrefix) Apply(ctx context.Context, b *bundle.Bundle) di
if strings.Contains(vv, path) {
diags = append(diags, diag.Diagnostic{
Severity: diag.Warning,
Summary: fmt.Sprintf("substring %q found in %q. Please update this to %q. For more information, please refer to: https://github.com/databricks/cli/blob/main/docs/release_notes/workspace_prefix.md", path, vv, strings.ReplaceAll(vv, "/Workspace/", "")),
Summary: fmt.Sprintf("substring %q found in %q. Please update this to %q. For more information, please refer to: https://github.com/databricks/cli/blob/main/docs/release_notes/workspace_prefix.md", path, vv, strings.Replace(vv, "/Workspace/", "", 1)),
Locations: v.Locations(),
Paths: []dyn.Path{p},
})

// Remove the workspace prefix from the string.
return dyn.NewValue(strings.ReplaceAll(vv, "/Workspace/", ""), v.Locations()), nil
return dyn.NewValue(strings.Replace(vv, "/Workspace/", "", 1), v.Locations()), nil
}
}

Expand Down
6 changes: 3 additions & 3 deletions bundle/config/mutator/rewrite_workspace_prefix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ func TestNoWorkspacePrefixUsed(t *testing.T) {
require.Len(t, diags, 3)

expectedErrors := map[string]bool{
"/Workspace/${workspace.root_path} used in the remote path /Workspace/${workspace.root_path}/file1.py. Please change to use ${workspace.root_path}/file1.py instead. See more details here: https://github.com/databricks/cli/blob/main/docs/release_notes/workspace_prefix.md": true,
"/Workspace/${workspace.file_path} used in the remote path /Workspace/${workspace.file_path}/notebook1. Please change to use ${workspace.file_path}/notebook1 instead. See more details here: https://github.com/databricks/cli/blob/main/docs/release_notes/workspace_prefix.md": true,
"/Workspace/${workspace.artifact_path} used in the remote path /Workspace/${workspace.artifact_path}/jar1.jar. Please change to use ${workspace.artifact_path}/jar1.jar instead. See more details here: https://github.com/databricks/cli/blob/main/docs/release_notes/workspace_prefix.md": true,
`substring "/Workspace/${workspace.root_path}" found in "/Workspace/${workspace.root_path}/file1.py". Please update this to "${workspace.root_path}/file1.py". For more information, please refer to: https://github.com/databricks/cli/blob/main/docs/release_notes/workspace_prefix.md`: true,
`substring "/Workspace/${workspace.file_path}" found in "/Workspace/${workspace.file_path}/notebook1". Please update this to "${workspace.file_path}/notebook1". For more information, please refer to: https://github.com/databricks/cli/blob/main/docs/release_notes/workspace_prefix.md`: true,
`substring "/Workspace/${workspace.artifact_path}" found in "/Workspace/${workspace.artifact_path}/jar1.jar". Please update this to "${workspace.artifact_path}/jar1.jar". For more information, please refer to: https://github.com/databricks/cli/blob/main/docs/release_notes/workspace_prefix.md`: true,
}

for _, d := range diags {
Expand Down

0 comments on commit b7ea53d

Please sign in to comment.