diff options
author | Victor Morales <victor.morales@intel.com> | 2018-09-29 16:43:37 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-09-29 16:43:37 +0000 |
commit | 89b46656fc2a150437017d396852508d3232ea43 (patch) | |
tree | 40e7455a7b8e256b6753068d5671a3ba3f6e8792 /src/k8splugin/krd/plugins.go | |
parent | 145648701486244f632cc6aaaa0f70a252db829a (diff) | |
parent | 5fe7119d93b68b1ee916dbe6a2c678395469df19 (diff) |
Merge "Add UTs for plugins module"
Diffstat (limited to 'src/k8splugin/krd/plugins.go')
-rw-r--r-- | src/k8splugin/krd/plugins.go | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/k8splugin/krd/plugins.go b/src/k8splugin/krd/plugins.go index 41b83226..9ccb04fa 100644 --- a/src/k8splugin/krd/plugins.go +++ b/src/k8splugin/krd/plugins.go @@ -38,21 +38,25 @@ type ResourceData struct { // DecodeYAML reads a YAMl file to extract the Kubernetes object definition var DecodeYAML = func(path string) (runtime.Object, error) { - if _, err := os.Stat(path); os.IsNotExist(err) { - return nil, pkgerrors.New("File " + path + " not found") + if _, err := os.Stat(path); err != nil { + if os.IsNotExist(err) { + return nil, pkgerrors.New("File " + path + " not found") + } else { + return nil, pkgerrors.Wrap(err, "Stat file error") + } } - log.Println("Reading deployment YAML") + log.Println("Reading YAML file") rawBytes, err := ioutil.ReadFile(path) if err != nil { - return nil, pkgerrors.Wrap(err, "Deployment YAML file read error") + return nil, pkgerrors.Wrap(err, "Read YAML file error") } log.Println("Decoding deployment YAML") decode := scheme.Codecs.UniversalDeserializer().Decode obj, _, err := decode(rawBytes, nil, nil) if err != nil { - return nil, pkgerrors.Wrap(err, "Deserialize deployment error") + return nil, pkgerrors.Wrap(err, "Deserialize YAML error") } return obj, nil |