Skip to content

Commit

Permalink
fix: use json.Unmarshal instead of yaml.Unmarshal
Browse files Browse the repository at this point in the history
Fixes #5510

JSON is a subset of YAML, but struct tags are declared for `json:""`, so
we need to use proper function call.

Signed-off-by: Andrey Smirnov <[email protected]>
  • Loading branch information
smira committed May 10, 2022
1 parent 6d30c48 commit 54cfa03
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ package openstack
import (
"bytes"
"context"
"encoding/json"
stderrors "errors"
"fmt"
"net"
"strconv"
"strings"

"github.com/talos-systems/go-procfs/procfs"
yaml "gopkg.in/yaml.v3"
"inet.af/netaddr"

"github.com/talos-systems/talos/internal/app/machined/pkg/runtime"
Expand Down Expand Up @@ -299,8 +299,8 @@ func (o *Openstack) NetworkConfiguration(ctx context.Context, ch chan<- *runtime
)

// ignore errors unmarshaling, empty configs work just fine as empty default
_ = yaml.Unmarshal(metadataConfigDl, &unmarshalledMetadataConfig) //nolint:errcheck
_ = yaml.Unmarshal(metadataNetworkConfigDl, &unmarshalledNetworkConfig) //nolint:errcheck
_ = json.Unmarshal(metadataConfigDl, &unmarshalledMetadataConfig) //nolint:errcheck
_ = json.Unmarshal(metadataNetworkConfigDl, &unmarshalledNetworkConfig) //nolint:errcheck

networkConfig, err := o.ParseMetadata(&unmarshalledMetadataConfig, &unmarshalledNetworkConfig, string(hostname), extIPs)
if err != nil {
Expand Down

0 comments on commit 54cfa03

Please sign in to comment.