MCPcopy Create free account
hub / github.com/cafebazaar/blacksmith / validateVariable

Function validateVariable

datasource/special_variables.go:76–94  ·  view source on GitHub ↗
(key, value string)

Source from the content-addressed store, hash-verified

74}
75
76func validateVariable(key, value string) error {
77 if key == "" {
78 return errors.New("empty value for key is not permitted")
79 }
80 if key[0] == '_' {
81 return errors.New("hidden key is not permitted")
82 }
83 if value == "" && emptyNotAllowed[key] {
84 return fmt.Errorf("empty value for %q is not permitted", key)
85 }
86 switch key {
87 case SpecialKeyCoreosVersion:
88 // TODO: more validation
89 case SpecialKeyNetworkConfiguration:
90 _, err := UnmarshalNetworkConfiguration(value)
91 return err
92 }
93 return nil
94}

Callers 3

SetVariableMethod · 0.85
SetClusterVariableMethod · 0.85
TestValidateVariableFunction · 0.85

Calls 1

Tested by 1

TestValidateVariableFunction · 0.68