Skip to content

Commit dd59261

Browse files
authored
Remove logrus as direct dependency (redhat-best-practices-for-k8s#2417)
* Remove logrus as direct dependency * Address comments; capitalization and printing error
1 parent 822271d commit dd59261

File tree

7 files changed

+10
-11
lines changed

7 files changed

+10
-11
lines changed

cmd/certsuite/generate/catalog/catalog.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727
"github.com/redhat-openshift-ecosystem/openshift-preflight/artifacts"
2828
plibContainer "github.com/redhat-openshift-ecosystem/openshift-preflight/container"
2929
plibOperator "github.com/redhat-openshift-ecosystem/openshift-preflight/operator"
30-
"github.com/sirupsen/logrus"
3130

3231
"github.com/redhat-best-practices-for-k8s/certsuite-claim/pkg/claim"
3332
"github.com/redhat-best-practices-for-k8s/certsuite/internal/log"
@@ -138,7 +137,7 @@ func addPreflightTestsToCatalog() {
138137
// Create artifacts handler
139138
artifactsWriter, err := artifacts.NewMapWriter()
140139
if err != nil {
141-
logrus.Errorf("error creating artifact, failed to add preflight tests to catalog")
140+
log.Error("Error creating artifact, failed to add preflight tests to catalog: %v", err)
142141
return
143142
}
144143
ctx := artifacts.ContextWithWriter(context.TODO(), artifactsWriter)
@@ -148,11 +147,11 @@ func addPreflightTestsToCatalog() {
148147
checkContainer := plibContainer.NewCheck(dummy, optsContainer...)
149148
_, checksOperator, err := checkOperator.List(ctx)
150149
if err != nil {
151-
logrus.Errorf("error getting preflight operator tests.")
150+
log.Error("Error getting preflight operator tests: %v", err)
152151
}
153152
_, checksContainer, err := checkContainer.List(ctx)
154153
if err != nil {
155-
logrus.Errorf("error getting preflight container tests.")
154+
log.Error("Error getting preflight container tests: %v", err)
156155
}
157156

158157
allChecks := checksOperator

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.23.1
55
require (
66
github.com/Masterminds/semver/v3 v3.3.0
77
github.com/redhat-best-practices-for-k8s/certsuite-claim v1.0.48
8-
github.com/sirupsen/logrus v1.9.3
8+
github.com/sirupsen/logrus v1.9.3 // indirect
99
github.com/spf13/cobra v1.8.1
1010
github.com/stretchr/testify v1.9.0
1111
github.com/xeipuuv/gojsonschema v1.2.0 // indirect

pkg/claimhelper/claimhelper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ func MarshalConfigurations() (configurations []byte, err error) {
281281
config := provider.GetTestEnvironment()
282282
configurations, err = j.Marshal(config)
283283
if err != nil {
284-
log.Error("error converting configurations to JSON: %v", err)
284+
log.Error("Error converting configurations to JSON: %v", err)
285285
return configurations, err
286286
}
287287
return configurations, nil

tests/accesscontrol/namespace/namespace.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func getCrsPerNamespaces(aCrd *apiextv1.CustomResourceDefinition) (crdNamespaces
7070
log.Debug("Looking for CRs from CRD: %s api version:%s group:%s plural:%s", aCrd.Name, version.Name, aCrd.Spec.Group, aCrd.Spec.Names.Plural)
7171
crs, err := oc.DynamicClient.Resource(gvr).List(context.TODO(), metav1.ListOptions{})
7272
if err != nil {
73-
log.Error("error getting %s: %v\n", aCrd.Name, err)
73+
log.Error("Error getting %s: %v\n", aCrd.Name, err)
7474
return crdNamespaces, err
7575
}
7676
crdNamespaces = make(map[string][]string)

tests/lifecycle/podrecreation/podrecreation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func CountPodsWithDelete(pods []*provider.Pod, nodeName, mode string) (count int
9090
}
9191
err := deletePod(put.Pod, mode, &wg)
9292
if err != nil {
93-
log.Error("error deleting %s", put)
93+
log.Error("Error deleting %s", put)
9494
}
9595
}
9696
}
@@ -124,7 +124,7 @@ func deletePod(pod *corev1.Pod, mode string, wg *sync.WaitGroup) error {
124124
GracePeriodSeconds: &gracePeriodSeconds,
125125
})
126126
if err != nil {
127-
log.Error("error deleting %s err: %v", pod.String(), err)
127+
log.Error("Error deleting %s err: %v", pod.String(), err)
128128
return err
129129
}
130130
if mode == DeleteBackground {

tests/platform/isredhat/isredhat.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func (b *BaseImageInfo) runCommand(cmd string) (string, error) {
7474
return "", err
7575
}
7676
if outerr != "" {
77-
log.Error("error when running baseimage command, err: %v", outerr)
77+
log.Error("Error when running baseimage command, err: %v", outerr)
7878
return "", errors.New(outerr)
7979
}
8080
return output, nil

tests/platform/nodetainted/nodetainted.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ var runCommand = func(ctx *clientsholder.Context, cmd string) (string, error) {
4141
return "", err
4242
}
4343
if outerr != "" {
44-
log.Error("error when running nodetainted command err=%v", outerr)
44+
log.Error("Error when running nodetainted command err=%v", outerr)
4545
return "", errors.New(outerr)
4646
}
4747
return output, nil

0 commit comments

Comments
 (0)