Skip to content

Commit

Permalink
Drop the yaml unmarshalling
Browse files Browse the repository at this point in the history
  • Loading branch information
ingvagabund committed Feb 12, 2019
1 parent 15fe4b4 commit 2986efa
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions pkg/apis/awsproviderconfig/v1beta1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import (
"bytes"
"fmt"

"github.com/ghodss/yaml"

machinev1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
Expand Down Expand Up @@ -78,11 +76,7 @@ func NewCodec() (*AWSProviderConfigCodec, error) {
// DecodeProviderSpec deserialises an object from the provider config
func (codec *AWSProviderConfigCodec) DecodeProviderSpec(providerSpec *machinev1.ProviderSpec, out runtime.Object) error {
if providerSpec.Value != nil {
// TODO(vikasc): revert back to using `Decode` once installer and mao have started using
// awsprovider apis pivoted under openshift.io api group
// _, _, err := codec.decoder.Decode(providerSpec.Value.Raw, nil, out)
// if err != nil {
if err := yaml.Unmarshal(providerSpec.Value.Raw, out); err != nil {
if _, _, err := codec.decoder.Decode(providerSpec.Value.Raw, nil, out); err != nil {
return fmt.Errorf("decoding failure: %v", err)
}
}
Expand Down Expand Up @@ -112,11 +106,7 @@ func (codec *AWSProviderConfigCodec) EncodeProviderStatus(in runtime.Object) (*r
// DecodeProviderStatus deserialises the provider status
func (codec *AWSProviderConfigCodec) DecodeProviderStatus(providerStatus *runtime.RawExtension, out runtime.Object) error {
if providerStatus != nil {
// TODO(vikasc): revert back to using `Decode` once installer and mao have started using
// awsprovider apis pivoted under openshift.io api group
//_, _, err := codec.decoder.Decode(providerStatus.Raw, nil, out)
if err := yaml.Unmarshal(providerStatus.Raw, out); err != nil {

if _, _, err := codec.decoder.Decode(providerStatus.Raw, nil, out); err != nil {
return fmt.Errorf("decoding failure: %v", err)
}
}
Expand Down

0 comments on commit 2986efa

Please sign in to comment.