mirror of https://github.com/databricks/cli.git
remove final telemetry bits
This commit is contained in:
parent
daa2b919aa
commit
a743139f83
|
@ -5,7 +5,6 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"slices"
|
|
||||||
|
|
||||||
"github.com/databricks/cli/libs/cmdio"
|
"github.com/databricks/cli/libs/cmdio"
|
||||||
"github.com/databricks/cli/libs/jsonschema"
|
"github.com/databricks/cli/libs/jsonschema"
|
||||||
|
@ -274,23 +273,3 @@ func (c *config) validate() error {
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return enum values selected by the user during template initialization. These
|
|
||||||
// values are safe to send over in telemetry events due to their limited cardinality.
|
|
||||||
func (c *config) enumValues() map[string]string {
|
|
||||||
res := map[string]string{}
|
|
||||||
for k, p := range c.schema.Properties {
|
|
||||||
if p.Type != jsonschema.StringType {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if p.Enum == nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
v := c.values[k]
|
|
||||||
|
|
||||||
if slices.Contains(p.Enum, v) {
|
|
||||||
res[k] = v.(string)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
|
|
|
@ -564,42 +564,3 @@ func TestPromptIsSkippedAnyOf(t *testing.T) {
|
||||||
assert.True(t, skip)
|
assert.True(t, skip)
|
||||||
assert.Equal(t, "hello-world", c.values["xyz"])
|
assert.Equal(t, "hello-world", c.values["xyz"])
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConfigEnumValues(t *testing.T) {
|
|
||||||
c := &config{
|
|
||||||
schema: &jsonschema.Schema{
|
|
||||||
Properties: map[string]*jsonschema.Schema{
|
|
||||||
"a": {
|
|
||||||
Type: jsonschema.StringType,
|
|
||||||
},
|
|
||||||
"b": {
|
|
||||||
Type: jsonschema.BooleanType,
|
|
||||||
},
|
|
||||||
"c": {
|
|
||||||
Type: jsonschema.StringType,
|
|
||||||
Enum: []any{"v1", "v2"},
|
|
||||||
},
|
|
||||||
"d": {
|
|
||||||
Type: jsonschema.StringType,
|
|
||||||
Enum: []any{"v3", "v4"},
|
|
||||||
},
|
|
||||||
"e": {
|
|
||||||
Type: jsonschema.StringType,
|
|
||||||
Enum: []any{"v5", "v6"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
values: map[string]any{
|
|
||||||
"a": "w1",
|
|
||||||
"b": false,
|
|
||||||
"c": "v1",
|
|
||||||
"d": "v3",
|
|
||||||
"e": "v7",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.Equal(t, map[string]string{
|
|
||||||
"c": "v1",
|
|
||||||
"d": "v3",
|
|
||||||
}, c.enumValues())
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue