Skip to content

Commit 9429164

Browse files
committed
Fix cidata user-data ca_certs yaml content
This is failing the cloud-config jsonschema validation, later. $ sudo cloud-init schema --system Error: Cloud config schema errors: ca_certs.trusted: None is not of type 'array' Signed-off-by: Anders F Björklund <[email protected]>
1 parent 9d31f2a commit 9429164

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

pkg/cidata/cidata.TEMPLATE.d/user-data

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,15 @@ resolv_conf:
6666
{{ with .CACerts }}
6767
ca_certs:
6868
remove_defaults: {{ .RemoveDefaults }}
69+
{{- if .Trusted}}
6970
trusted:
7071
{{- range $cert := .Trusted }}
7172
- |
7273
{{- range $line := $cert.Lines }}
7374
{{ $line }}
7475
{{- end }}
7576
{{- end }}
77+
{{- end }}
7678
{{- end }}
7779

7880
{{- if .BootCmds }}

pkg/cidata/template_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ func TestTemplate(t *testing.T) {
2222
{MountPoint: "/Users/dummy/lima"},
2323
},
2424
MountType: "reverse-sshfs",
25+
CACerts: CACerts{
26+
Trusted: []Cert{},
27+
},
2528
}
2629
layout, err := ExecuteTemplate(args)
2730
assert.NilError(t, err)
@@ -33,6 +36,8 @@ func TestTemplate(t *testing.T) {
3336
if f.Path == "user-data" {
3437
// mounted later
3538
assert.Assert(t, !strings.Contains(string(b), "mounts:"))
39+
// ca_certs:
40+
assert.Assert(t, !strings.Contains(string(b), "trusted:"))
3641
}
3742
}
3843
}

0 commit comments

Comments
 (0)