Skip to content

Commit

Permalink
fix #4136: logging at warning only if warning was requested
Browse files Browse the repository at this point in the history
  • Loading branch information
shawkins authored and manusa committed Dec 2, 2022
1 parent 02e70d1 commit f6902ec
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -30,6 +30,7 @@
import io.fabric8.kubernetes.client.Client;
import io.fabric8.kubernetes.client.Config;
import io.fabric8.kubernetes.client.KubernetesClientException;
import io.fabric8.kubernetes.client.dsl.FieldValidateable.Validation;
import io.fabric8.kubernetes.client.dsl.base.PatchContext;
import io.fabric8.kubernetes.client.dsl.base.PatchType;
import io.fabric8.kubernetes.client.http.HttpClient;
Expand Down Expand Up @@ -646,7 +647,11 @@ protected void retryWithExponentialBackoff(CompletableFuture<HttpResponse<byte[]
protected void assertResponseCode(HttpRequest request, HttpResponse<?> response) {
List<String> warnings = response.headers("Warning");
if (warnings != null && !warnings.isEmpty()) {
LOG.warn("Recieved warning(s) from request at {}: {}", request.uri(), warnings);
if (context.fieldValidation == Validation.WARN) {
LOG.warn("Recieved warning(s) from request {}: {}", request.uri(), warnings);
} else {
LOG.debug("Recieved warning(s) from request {}: {}", request.uri(), warnings);
}
}
if (response.isSuccessful()) {
return;
Expand Down

0 comments on commit f6902ec

Please sign in to comment.