Minor improvement to log statements 37/91837/1
authorKiran Kamineni <kiran.k.kamineni@intel.com>
Tue, 23 Jul 2019 00:02:55 +0000 (17:02 -0700)
committerKiran Kamineni <kiran.k.kamineni@intel.com>
Tue, 23 Jul 2019 00:03:00 +0000 (17:03 -0700)
Removing some log statements that are cluttering the output.
Added a log statement to print errors during instantiation.

Issue-ID: MULTICLOUD-666
Change-Id: I76ad59c9cb36b5cb999573afec18e6f1adbed4ad
Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
src/k8splugin/internal/app/client.go
src/k8splugin/internal/utils.go
src/k8splugin/plugins/generic/plugin.go

index 8d2af29..d44f350 100644 (file)
@@ -122,8 +122,6 @@ func (k *KubernetesClient) ensureNamespace(namespace string) error {
 func (k *KubernetesClient) createKind(resTempl helm.KubernetesResourceTemplate,
        namespace string) (helm.KubernetesResource, error) {
 
-       log.Println("Processing Kind: " + resTempl.GVK.Kind)
-
        if _, err := os.Stat(resTempl.FilePath); os.IsNotExist(err) {
                return helm.KubernetesResource{}, pkgerrors.New("File " + resTempl.FilePath + "does not exists")
        }
@@ -137,6 +135,7 @@ func (k *KubernetesClient) createKind(resTempl helm.KubernetesResourceTemplate,
 
        createdResourceName, err := pluginImpl.Create(resTempl.FilePath, namespace, k)
        if err != nil {
+               log.Printf("Error: %s while creating: %s", err.Error(), resTempl.GVK.Kind)
                return helm.KubernetesResource{}, pkgerrors.Wrap(err, "Error in plugin "+resTempl.GVK.Kind+" plugin")
        }
 
index 47a236c..174f8e7 100644 (file)
@@ -17,8 +17,8 @@ import (
        "io/ioutil"
        "log"
        "os"
-       "path/filepath"
        "path"
+       "path/filepath"
        "plugin"
        "strings"
 
@@ -52,13 +52,11 @@ func DecodeYAML(path string, into runtime.Object) (runtime.Object, error) {
                }
        }
 
-       log.Println("Reading YAML file")
        rawBytes, err := ioutil.ReadFile(path)
        if err != nil {
                return nil, pkgerrors.Wrap(err, "Read YAML file error")
        }
 
-       log.Println("Decoding deployment YAML")
        decode := scheme.Codecs.UniversalDeserializer().Decode
        obj, _, err := decode(rawBytes, nil, into)
        if err != nil {
index b9a96ab..bcb3b3d 100644 (file)
@@ -14,8 +14,6 @@ limitations under the License.
 package main
 
 import (
-       "log"
-
        pkgerrors "github.com/pkg/errors"
        "k8s.io/apimachinery/pkg/api/meta"
        metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -23,8 +21,8 @@ import (
        "k8s.io/apimachinery/pkg/runtime/schema"
 
        utils "github.com/onap/multicloud-k8s/src/k8splugin/internal"
-       "github.com/onap/multicloud-k8s/src/k8splugin/internal/plugin"
        "github.com/onap/multicloud-k8s/src/k8splugin/internal/helm"
+       "github.com/onap/multicloud-k8s/src/k8splugin/internal/plugin"
 )
 
 // ExportedVariable is what we will look for when calling the generic plugin
@@ -94,8 +92,6 @@ func (g genericPlugin) Get(resource helm.KubernetesResource,
        }
 
        gvr := mapping.Resource
-       log.Printf("Using gvr: %s, %s, %s", gvr.Group, gvr.Version, gvr.Resource)
-
        opts := metav1.GetOptions{}
        var unstruct *unstructured.Unstructured
        switch mapping.Scope.Name() {
@@ -141,8 +137,6 @@ func (g genericPlugin) Delete(resource helm.KubernetesResource, namespace string
        }
 
        gvr := mapping.Resource
-       log.Printf("Using gvr: %s, %s, %s", gvr.Group, gvr.Version, gvr.Resource)
-
        deletePolicy := metav1.DeletePropagationForeground
        opts := &metav1.DeleteOptions{
                PropagationPolicy: &deletePolicy,