Skip to content

Commit

Permalink
scc: adjust return consistency (openshift-kni#863)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebrandon1 authored and klaskosk committed Jan 10, 2025
1 parent fa96796 commit 5251924
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/scc/scc.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func Pull(apiClient *clients.Settings, name string) (*Builder, error) {
return nil, fmt.Errorf("failed to add security v1 scheme to client schemes")
}

builder := Builder{
builder := &Builder{
apiClient: apiClient,
Definition: &securityV1.SecurityContextConstraints{
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -131,7 +131,7 @@ func Pull(apiClient *clients.Settings, name string) (*Builder, error) {

builder.Definition = builder.Object

return &builder, nil
return builder, nil
}

// WithPrivilegedContainer adds bool flag to the allowPrivilegedContainer of SecurityContextConstraints.
Expand Down Expand Up @@ -609,7 +609,7 @@ func (builder *Builder) Get() (*securityV1.SecurityContextConstraints, error) {
return nil, err
}

return scc, err
return scc, nil
}

// Exists checks whether the given SecurityContextConstraints exists.
Expand Down Expand Up @@ -644,13 +644,13 @@ func (builder *Builder) validate() (bool, error) {
if builder.Definition == nil {
glog.V(100).Infof("The %s is undefined", resourceCRD)

builder.errorMsg = msg.UndefinedCrdObjectErrString(resourceCRD)
return false, fmt.Errorf(msg.UndefinedCrdObjectErrString(resourceCRD))
}

if builder.apiClient == nil {
glog.V(100).Infof("The %s builder apiclient is nil", resourceCRD)

builder.errorMsg = fmt.Sprintf("%s builder cannot have nil apiClient", resourceCRD)
return false, fmt.Errorf("%s builder cannot have nil apiClient", resourceCRD)
}

if builder.errorMsg != "" {
Expand Down

0 comments on commit 5251924

Please sign in to comment.