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:
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 {
|
||||
|
||||
@@ -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" {
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user