Skip to content

Commit

Permalink
kubernetes: Look at response status as well as code
Browse files Browse the repository at this point in the history
Some kubernetes endpoints aren't returning proper json
responses for 403s. So look at the response status for
codes as well.

Closes #7715 
Reviewed-by: Stef Walter <stefw@redhat.com>
  • Loading branch information
petervo authored and stefwalter committed Sep 20, 2017
1 parent 87904df commit 2bed810
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/kubernetes/scripts/kube-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1230,9 +1230,12 @@
step();
}, function(response) {
var resp = response.data;
var code = response.status;
if (resp && resp.code)
code = resp.code;

/* Ignore failures creating the namespace if it already exists */
if (resource.kind == "Namespace" && resp && (resp.code === 409 || resp.code === 403)) {
if (resource.kind == "Namespace" && (code === 409 || code === 403)) {
debug("skipping namespace creation");
step();
} else {
Expand Down

0 comments on commit 2bed810

Please sign in to comment.