The controller plans config, templates and moved providers' provisions, hands bus accounts to the vault and judges the new manifest words, on the feature's SDK and node-engine validator (feature 57, config and provisioning).
41 lines
1.6 KiB
Go
41 lines
1.6 KiB
Go
package catalogue
|
|
|
|
import "strings"
|
|
|
|
// What the move of config reads of a module's declaration (novox/hq ADR 0348 §9, design 57 K5, issue 664): where a
|
|
// layer's key goes, how two layers' values become one, and whether a value is one its declaration takes.
|
|
|
|
// TakenAs is each name a mergeable file takes a config value under that is not the value's config key, with that
|
|
// key (issue 751): a layer set before the module moved may still say the file's name, and the move sets it under
|
|
// the config key.
|
|
func TakenAs(m Manifest) map[string]string {
|
|
out := map[string]string{}
|
|
for key, as := range renamedTaken(m) {
|
|
out[as] = key
|
|
}
|
|
return out
|
|
}
|
|
|
|
// AskedKeys is every value a placeholder of the module asks for: a file, a unit, a directory's owner, a
|
|
// contribution or a served fact. Such a value is taken whole from the last layer that sets it, where a mergeable
|
|
// file lays one object over another key by key.
|
|
func AskedKeys(m Manifest) map[string]bool { return settingKeysUsedBy(m) }
|
|
|
|
// LaidOver is a value laid over another as a later layer is laid over an earlier: two objects key by key, anything
|
|
// else replaced whole.
|
|
func LaidOver(under, over any) any { return mergeValue(under, over) }
|
|
|
|
// ValueProblems is what is wrong with a value for a declaration: its type, and its enum, bounds or pattern.
|
|
func ValueProblems(d SettingDeclaration, v any) []string {
|
|
if v == nil {
|
|
return []string{"no value"}
|
|
}
|
|
d.Default = v
|
|
d.Required = false
|
|
var problems []string
|
|
for _, p := range validationProblems(d) {
|
|
problems = append(problems, strings.ReplaceAll(p, "its default", "the value"))
|
|
}
|
|
return problems
|
|
}
|