Fix missing template variables in DABs bundle init#289
Open
shdzhang wants to merge 1 commit intodatabricks-industry-solutions:mainfrom
Open
Fix missing template variables in DABs bundle init#289shdzhang wants to merge 1 commit intodatabricks-industry-solutions:mainfrom
shdzhang wants to merge 1 commit intodatabricks-industry-solutions:mainfrom
Conversation
The databricks.yml.tmpl template referenced is_service_principal, user_name, and workspace_host but none were defined in the schema or populated in the config, causing bundle init to fail. Added the variables to the schema, fixed Go template syntax (missing dot prefix), and added auto-detection of current identity in main.py. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The DABs installer fails when the
.databrickscfgprofile authenticates as a service principal. Thedatabricks.yml.tmpltemplate references three variables (is_service_principal,user_name,workspace_host) that were neither declared in the template schema nor populated in the config file, causingdatabricks bundle initto fail with:Additionally, the template used incorrect Go template syntax —
{{workspace_host}}instead of{{.workspace_host}}.Fix:
is_service_principal,user_name,workspace_host) to the template schemadatabricks.yml.tmpl(added.prefix to all variable references)main.pyusingclient.current_user.me(), which determines whether the caller is a service principal or a regular user and setsrun_asaccordinglyType of Change
How Has This Been Tested?
./install.shwith a service principal profiledatabricks bundle initwas failing with exit code 1 and the output directory was not being createdChecklist
Additional Notes
"@" not in user_name) relies on the fact that service principals have UUID-format usernames while regular users have email addresses. This is consistent with Databricks SCIM API behavior across all clouds.run_asusesuser_name:; when authenticated as a service principal, it usesservice_principal_name:.