shared/subprocess: Switch to go-yaml/v4

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
This commit is contained in:
Stéphane Graber 2026-03-31 02:36:31 +00:00
parent cda3ac59b7
commit 28e767d808
No known key found for this signature in database
GPG Key ID: C638974D64792D67
2 changed files with 4 additions and 4 deletions

View File

@ -7,7 +7,7 @@ import (
"io"
"os"
"gopkg.in/yaml.v2"
"go.yaml.in/yaml/v4"
)
// NewProcess is a constructor for a process object. Represents a process with argument config.
@ -58,7 +58,7 @@ func ImportProcess(path string) (*Process, error) {
}
proc := Process{}
err = yaml.Unmarshal(dat, &proc)
err = yaml.Load(dat, &proc)
if err != nil {
return nil, fmt.Errorf("Unable to parse YAML in PID file %q: %w", path, err)
}

View File

@ -11,7 +11,7 @@ import (
"os/exec"
"syscall"
"gopkg.in/yaml.v2"
"go.yaml.in/yaml/v4"
"github.com/lxc/incus/v6/shared/util"
)
@ -269,7 +269,7 @@ func (p *Process) Reload() error {
// Save will save the given process object to a YAML file. Can be imported at a later point.
func (p *Process) Save(path string) error {
dat, err := yaml.Marshal(p)
dat, err := yaml.Dump(p, yaml.V2)
if err != nil {
return fmt.Errorf("Unable to serialize process struct to YAML: %w", err)
}