Merge pull request #465 from monopole/moveYamlCheck

Move yaml check to file in which it is called.
This commit is contained in:
Jeff Regan
2018-10-15 09:40:31 -07:00
committed by GitHub
2 changed files with 5 additions and 4 deletions

View File

@@ -19,6 +19,7 @@ package kunstruct
import (
"bytes"
"io"
"strings"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/util/yaml"
@@ -60,6 +61,10 @@ func (kf *KunstructurerFactoryImpl) SliceFromBytes(
return result, nil
}
func isEmptyYamlError(err error) bool {
return strings.Contains(err.Error(), "is missing in 'null'")
}
// FromMap returns an instance of Kunstructured.
func (kf *KunstructurerFactoryImpl) FromMap(
m map[string]interface{}) ifc.Kunstructured {

View File

@@ -104,7 +104,3 @@ func getFieldValue(m map[string]interface{}, pathToField []string) (string, erro
return "", fmt.Errorf("%#v is not expected to be a primitive type", typedV)
}
}
func isEmptyYamlError(err error) bool {
return strings.Contains(err.Error(), "is missing in 'null'")
}