edgefs: error checking for ineffectual assignments

All assignments made to errors or other variables should be
used instead of ignored. This checks for errors in a couple
places that were previously ignored, and also initializes
a variable such that it won't be always overwritten by the
various if else statements.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
This commit is contained in:
Travis Nielsen committed 2020-07-20 17:11:37 -06:00
1 parent 14d4ed447e
commit 7bef54c089
3 files changed
+8 -2

No files matched your search

@@ -26,7 +26,7 @@ import (
"github.com/rook/rook/pkg/clusterd"
"github.com/rook/rook/pkg/operator/k8sutil"
batch "k8s.io/api/batch/v1"
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
@@ -158,6 +158,9 @@ func (c *Cluster) waitJob(job *batch.Job) error {
batchClient := c.context.Clientset.BatchV1()
jobsClient := batchClient.Jobs(job.ObjectMeta.Namespace)
watch, err := jobsClient.Watch(metav1.ListOptions{LabelSelector: "job-name=" + job.ObjectMeta.Name})
if err != nil {
return fmt.Errorf("Failed to watch job %s", job.ObjectMeta.Name)
}
k8sjob, err := jobsClient.Get(job.ObjectMeta.Name, metav1.GetOptions{})
if err != nil {
+1 -1
View File
@@ -281,7 +281,7 @@ func (c *ISGWController) isgwContainer(svcname, name, containerImage string, isg
direction := getDirection(isgwSpec)
replication := 3
var replication int
if isgwSpec.ReplicationType == "initial" {
replication = 1
} else if isgwSpec.ReplicationType == "continuous" {
+3
View File
@@ -34,6 +34,9 @@ import (
func getMonitoringClient() (*monitoringclient.Clientset, error) {
cfg, err := clientcmd.BuildConfigFromFlags("", "")
if err != nil {
return nil, fmt.Errorf("failed to build config. %v", err)
}
client, err := monitoringclient.NewForConfig(cfg)
if err != nil {
return nil, fmt.Errorf("failed to get monitoring client. %v", err)