mirror of https://github.com/databricks/cli.git
Do not use `.MustString()` in auth interpolation warning (#2412)
## Why Addresses post merge feedback from https://github.com/databricks/cli/pull/2399#discussion_r1975091730 ## Tests N/A
This commit is contained in:
parent
8f8f24c3a9
commit
25a7e0a72b
|
@ -24,7 +24,10 @@ func (f *noInterpolationInAuthConfig) Name() string {
|
||||||
func (f *noInterpolationInAuthConfig) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostics {
|
func (f *noInterpolationInAuthConfig) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostics {
|
||||||
authFields := []string{
|
authFields := []string{
|
||||||
// Generic attributes.
|
// Generic attributes.
|
||||||
"host", "profile", "auth_type", "metadata_service_url",
|
"host",
|
||||||
|
"profile",
|
||||||
|
"auth_type",
|
||||||
|
"metadata_service_url",
|
||||||
|
|
||||||
// OAuth specific attributes.
|
// OAuth specific attributes.
|
||||||
"client_id",
|
"client_id",
|
||||||
|
@ -33,8 +36,12 @@ func (f *noInterpolationInAuthConfig) Apply(ctx context.Context, b *bundle.Bundl
|
||||||
"google_service_account",
|
"google_service_account",
|
||||||
|
|
||||||
// Azure specific attributes.
|
// Azure specific attributes.
|
||||||
"azure_resource_id", "azure_use_msi", "azure_client_id", "azure_tenant_id",
|
"azure_resource_id",
|
||||||
"azure_environment", "azure_login_app_id",
|
"azure_use_msi",
|
||||||
|
"azure_client_id",
|
||||||
|
"azure_tenant_id",
|
||||||
|
"azure_environment",
|
||||||
|
"azure_login_app_id",
|
||||||
}
|
}
|
||||||
|
|
||||||
diags := diag.Diagnostics{}
|
diags := diag.Diagnostics{}
|
||||||
|
@ -49,12 +56,11 @@ func (f *noInterpolationInAuthConfig) Apply(ctx context.Context, b *bundle.Bundl
|
||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if v.Kind() == dyn.KindInvalid || v.Kind() == dyn.KindNil {
|
vv, ok := v.AsString()
|
||||||
|
if !ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
vv := v.MustString()
|
|
||||||
|
|
||||||
// Check if the field contains interpolation.
|
// Check if the field contains interpolation.
|
||||||
if dynvar.ContainsVariableReference(vv) {
|
if dynvar.ContainsVariableReference(vv) {
|
||||||
envVar, ok := auth.GetEnvFor(fieldName)
|
envVar, ok := auth.GetEnvFor(fieldName)
|
||||||
|
|
Loading…
Reference in New Issue