platform/conf: accept CLCs in conf.Unknown()
It's only used in two user-facing applications, "kola spawn" and
"ore packet create-device". In both cases it would be convenient to
accept Container Linux Configs.
@@ -111,9 +111,16 @@ func Unknown(data string) *UserData {
case v21.ErrScript:
u.kind = kindScript
default:
- // we don't autodetect Container Linux configs
+ // Guess whether this is an Ignition config or a CLC.
+ // This treats an invalid Ignition config as a CLC, and a
+ // CLC in the JSON subset of YAML as an Ignition config.
+ var decoded interface{}
+ if err := json.Unmarshal([]byte(data), &decoded); err != nil {
+ u.kind = kindContainerLinuxConfig
+ } else {
u.kind = kindIgnition
}
+ }
return u
}
