Skip to content

Comments

Fix missing template variables in DABs bundle init#289

Open
shdzhang wants to merge 1 commit intodatabricks-industry-solutions:mainfrom
shdzhang:fix/dabs-template-missing-variables
Open

Fix missing template variables in DABs bundle init#289
shdzhang wants to merge 1 commit intodatabricks-industry-solutions:mainfrom
shdzhang:fix/dabs-template-missing-variables

Conversation

@shdzhang
Copy link
Contributor

@shdzhang shdzhang commented Feb 12, 2026

Description

The DABs installer fails when the .databrickscfg profile authenticates as a service principal. The databricks.yml.tmpl template references three variables (is_service_principal, user_name, workspace_host) that were neither declared in the template schema nor populated in the config file, causing databricks bundle init to fail with:

Error: failed to compute file content for tmp/databricks.yml.tmpl. variable "is_service_principal" not defined
./setup.sh: line 12: cd: tmp: No such file or directory
Error: unable to locate bundle root: databricks.yml not found

Additionally, the template used incorrect Go template syntax — {{workspace_host}} instead of {{.workspace_host}}.

Fix:

  • Added the three missing variable declarations (is_service_principal, user_name, workspace_host) to the template schema
  • Fixed Go template syntax in databricks.yml.tmpl (added . prefix to all variable references)
  • Added auto-detection of the current identity in main.py using client.current_user.me(), which determines whether the caller is a service principal or a regular user and sets run_as accordingly

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Reproduced the original error by running ./install.sh with a service principal profile
  • Verified the config file contents via debug instrumentation to confirm the missing variables
  • Confirmed databricks bundle init was failing with exit code 1 and the output directory was not being created
  • Applied the fix and verified successful deployment with both user and service principal authentication

Checklist

  • I have reviewed the CONTRIBUTING and VERSIONING documentation.
  • My code follows the code style of this project.
  • I have verified, added or updated the tests to cover my changes (if applicable).
  • I have verified that my changes do not introduce any breaking changes on all the supported clouds (AWS, Azure, GCP).
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation (if applicable).

Additional Notes

  • The identity detection heuristic ("@" 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.
  • When authenticated as a regular user, run_as uses user_name:; when authenticated as a service principal, it uses service_principal_name:.

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>
@CLAassistant
Copy link

CLAassistant commented Feb 12, 2026

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants