Skip to content

Commit

Permalink
ocm: add logs to get errors (#793)
Browse files Browse the repository at this point in the history
Similar to a change from #763, Exist can return true even if Get returns an error, causing Pull to succeed but Definition to be nil. By adding a log to Get, this error is no longer silent and has a more obvious root cause.
  • Loading branch information
klaskosk authored Nov 22, 2024
1 parent 477b86e commit 8c81107
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/ocm/placementbinding.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ func (builder *PlacementBindingBuilder) Get() (*policiesv1.PlacementBinding, err
}, placementBinding)

if err != nil {
glog.V(100).Infof("Failed to get placementBinding %s in namespace %s: %v",
builder.Definition.Name, builder.Definition.Namespace, err)

return nil, err
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/ocm/placementrule.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ func (builder *PlacementRuleBuilder) Get() (*placementrulev1.PlacementRule, erro
}, placementRule)

if err != nil {
glog.V(100).Infof("Failed to get placementrule %s in namespace %s: %v",
builder.Definition.Name, builder.Definition.Namespace, err)

return nil, err
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/ocm/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ func (builder *PolicyBuilder) Get() (*policiesv1.Policy, error) {
}, policy)

if err != nil {
glog.V(100).Infof("Failed to get policy %s in namespace %s: %v",
builder.Definition.Name, builder.Definition.Namespace, err)

return nil, err
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/ocm/policyset.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ func (builder *PolicySetBuilder) Get() (*policiesv1beta1.PolicySet, error) {
}, policySet)

if err != nil {
glog.V(100).Infof("Failed to get policySet %s in namespace %s: %v",
builder.Definition.Name, builder.Definition.Namespace, err)

return nil, err
}

Expand Down

0 comments on commit 8c81107

Please sign in to comment.