fix(LXC): network deletion
This commit is contained in:
3
Makefile
3
Makefile
@@ -123,3 +123,6 @@ conformance-test-discovery: install
|
|||||||
test-request:
|
test-request:
|
||||||
curl -k -H "Authorization: PVEAPIToken=$$PROXMOX_USERNAME=$$PROXMOX_TOKEN" "https://proxmox.mid:8006/api2/json/nodes/proxmox/lxc" | jq
|
curl -k -H "Authorization: PVEAPIToken=$$PROXMOX_USERNAME=$$PROXMOX_TOKEN" "https://proxmox.mid:8006/api2/json/nodes/proxmox/lxc" | jq
|
||||||
curl -k -H "Authorization: PVEAPIToken=$$PROXMOX_USERNAME=$$PROXMOX_TOKEN" "https://proxmox.mid:8006/api2/json/nodes/proxmox/lxc/200/config" | jq
|
curl -k -H "Authorization: PVEAPIToken=$$PROXMOX_USERNAME=$$PROXMOX_TOKEN" "https://proxmox.mid:8006/api2/json/nodes/proxmox/lxc/200/config" | jq
|
||||||
|
|
||||||
|
test-delete:
|
||||||
|
curl -k -H "Authorization: PVEAPIToken=$$PROXMOX_USERNAME=$$PROXMOX_TOKEN" "https://proxmox.mid:8006/api2/json/nodes/proxmox/lxc/210/config" -X PUT --data "delete=net0,net1,net2" | jq
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ func authenticatedRequest(method, url, authorization string, urlparams url.Value
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
slog.Debug("Executed Request", "url", method, "status code", resp.Status, "body", string(data))
|
slog.Debug("Executed Request", "url", method, "params", urlparams, "status code", resp.Status, "body", string(data))
|
||||||
|
|
||||||
return data, nil
|
return data, nil
|
||||||
}
|
}
|
||||||
|
|||||||
2
lxc.go
2
lxc.go
@@ -305,7 +305,7 @@ func (p *Plugin) UpdateLXC(ctx context.Context, req *resource.UpdateRequest) (*r
|
|||||||
}
|
}
|
||||||
|
|
||||||
toDelete := []string{}
|
toDelete := []string{}
|
||||||
for i := range min(MAX_NETWORK_COUNT, len(desir.Networks)) {
|
for i := range min(MAX_NETWORK_COUNT, max(len(desir.Networks), len(prior.Networks))) {
|
||||||
if i < len(desir.Networks) {
|
if i < len(desir.Networks) {
|
||||||
urlparams.Add(fmt.Sprintf("net%d", i), desir.Networks[i])
|
urlparams.Add(fmt.Sprintf("net%d", i), desir.Networks[i])
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user