We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 47f9960 commit 139f69aCopy full SHA for 139f69a
pkg/cidata/schema.go
@@ -1,7 +1,9 @@
1
package cidata
2
3
import (
4
+ "bytes"
5
_ "embed"
6
+ "fmt"
7
"strings"
8
9
"github.com/santhosh-tekuri/jsonschema/v5"
@@ -14,6 +16,9 @@ const schemaURL = "https://raw.githubusercontent.com/canonical/cloud-init/main/c
14
16
var schemaText string
15
17
18
func validateCloudConfig(userData []byte) error {
19
+ if !bytes.HasPrefix(userData, []byte("#cloud-config")) {
20
+ return fmt.Errorf("missing #cloud-config")
21
+ }
22
var m interface{}
23
err := yaml.Unmarshal(userData, &m)
24
if err != nil {
0 commit comments