Skip to content

Commit 5706322

Browse files
authored
Add error context to log messages for ansible proxy (operator-framework#2640)
Add some of the logging messages do not have any error context included. Motivation for the change: Related operator-framework#2623
1 parent b26a7d9 commit 5706322

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pkg/ansible/proxy/cache_response.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func (c *cacheResponseHandler) ServeHTTP(w http.ResponseWriter, req *http.Reques
8181
k, err := getGVKFromRequestInfo(r, c.restMapper)
8282
if err != nil {
8383
// break here in case resource doesn't exist in cache
84-
log.Info("Cache miss, can not find in rest mapper")
84+
log.Error(err, "Cache miss, can not find in rest mapper")
8585
break
8686
}
8787

@@ -94,7 +94,7 @@ func (c *cacheResponseHandler) ServeHTTP(w http.ResponseWriter, req *http.Reques
9494
isVR, err := c.apiResources.IsVirtualResource(k)
9595
if err != nil {
9696
// break here in case we can not understand if virtual resource or not
97-
log.Info("Unable to determine if virtual resource", "gvk", k)
97+
log.Error(err, "Unable to determine if virtual resource", "gvk", k)
9898
break
9999
}
100100

pkg/ansible/proxy/inject_owner.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,15 @@ func (i *injectOwnerReferenceHandler) ServeHTTP(w http.ResponseWriter, req *http
7474
k, err := getGVKFromRequestInfo(r, i.restMapper)
7575
if err != nil {
7676
// break here in case resource doesn't exist in cache
77-
log.Info("Cache miss, can not find in rest mapper")
77+
log.Error(err, "Cache miss, can not find in rest mapper")
7878
break
7979
}
8080

8181
// Determine if the resource is virtual. If it is then we should not attempt to use cache
8282
isVR, err := i.apiResources.IsVirtualResource(k)
8383
if err != nil {
8484
// break here in case we can not understand if virtual resource or not
85-
log.Info("Unable to determine if virtual resource", "gvk", k)
85+
log.Error(err, "Unable to determine if virtual resource", "gvk", k)
8686
break
8787
}
8888

0 commit comments

Comments
 (0)