fix: add creation password
Some checks failed
CI / build (push) Failing after 3m45s
CI / lint (push) Failing after 3m20s
CI / pkl-validate (push) Successful in 11s
CI / integration-tests (push) Has been skipped
CI / conformance-tests (latest) (push) Has been skipped

This commit is contained in:
2026-02-12 23:14:19 +01:00
parent 476906fe97
commit 959257eac8
6 changed files with 8 additions and 0 deletions

1
lxc.go
View File

@@ -69,6 +69,7 @@ func (p *Plugin) CreateLXC(ctx context.Context, req *resource.CreateRequest) (*r
urlparams := url.Values{ urlparams := url.Values{
"vmid": {props.VMID}, "vmid": {props.VMID},
"ostemplate": {props.OSTemplate}, "ostemplate": {props.OSTemplate},
"password": {props.Password},
"hostname": {props.Hostname}, "hostname": {props.Hostname},
"cores": {strconv.Itoa(props.Cores)}, "cores": {strconv.Itoa(props.Cores)},
"memory": {strconv.Itoa(props.Memory)}, "memory": {strconv.Itoa(props.Memory)},

View File

@@ -31,6 +31,7 @@ func TestCreate(t *testing.T) {
"hostname": "testlxc", "hostname": "testlxc",
"description": "none", "description": "none",
"ostemplate": "local:vztmpl/alpine-3.22-default_20250617_amd64.tar.xz", "ostemplate": "local:vztmpl/alpine-3.22-default_20250617_amd64.tar.xz",
"password": "password",
"cores": 1, "cores": 1,
"memory": 512, "memory": 512,
} }

View File

@@ -28,6 +28,9 @@ class LXC extends formae.Resource {
@formae.FieldHint {} @formae.FieldHint {}
ostemplate: String? ostemplate: String?
@formae.FieldHint {}
password: String?
@formae.FieldHint {} @formae.FieldHint {}
hostname: String hostname: String

View File

@@ -31,6 +31,7 @@ forma {
hostname = "test-lxc" hostname = "test-lxc"
description = "some other description" description = "some other description"
ostemplate = "local:vztmpl/alpine-3.22-default_20250617_amd64.tar.xz" ostemplate = "local:vztmpl/alpine-3.22-default_20250617_amd64.tar.xz"
password = "test"
cores = 1 cores = 1
memory = 512 memory = 512
} }

View File

@@ -33,6 +33,7 @@ forma {
hostname = "test-lxc" hostname = "test-lxc"
description = "no description provided" description = "no description provided"
ostemplate = "local:vztmpl/alpine-3.22-default_20250617_amd64.tar.xz" ostemplate = "local:vztmpl/alpine-3.22-default_20250617_amd64.tar.xz"
password = "abcd"
cores = 1 cores = 1
memory = 512 memory = 512
} }

View File

@@ -12,6 +12,7 @@ type LXCProperties struct {
Hostname string `json:"hostname"` Hostname string `json:"hostname"`
Description string `json:"description,omitempty"` Description string `json:"description,omitempty"`
OSTemplate string `json:"ostemplate,omitempty"` OSTemplate string `json:"ostemplate,omitempty"`
Password string `json:"password,omitempty"`
Cores int `json:"cores"` Cores int `json:"cores"`
Memory int `json:"memory"` Memory int `json:"memory"`
OnBoot int `json:"onboot"` OnBoot int `json:"onboot"`