Skip to content

Commit fb1b1b4

Browse files
authored
In retryablehttp client CheckRetry method, return err object when we don't want to retry (#421)
In the current implementation, the error from the HTTP client is gobbled up when a retryablehttp client is used. Changing it to have the CheckRetry implementation used by pf9ctl to return any error the request receieved and retry was not needed. Fixes: PCD-3055
1 parent 8f50c2b commit fb1b1b4

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

cmd/detachNode.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func detachNodeRun(cmd *cobra.Command, args []string) {
126126

127127
}
128128

129-
//returns the nodes whos ip's were passed in the flag (or the node installed on the machine if no ip was passed)
129+
// returns the nodes whos ip's were passed in the flag (or the node installed on the machine if no ip was passed)
130130
func getNodesFromUuids(nodeUuids []string, allNodes []qbert.Node) ([]qbert.Node, error) {
131131

132132
var nodesUuid []qbert.Node
@@ -147,7 +147,7 @@ func getNodesFromUuids(nodeUuids []string, allNodes []qbert.Node) ([]qbert.Node,
147147
return nodesUuid, nil
148148
}
149149

150-
//returns a list of all clusters the nodes are attached to
150+
// returns a list of all clusters the nodes are attached to
151151
func getClusters(allNodes []qbert.Node) []string {
152152

153153
var clusters []string
@@ -170,7 +170,7 @@ func getClusters(allNodes []qbert.Node) []string {
170170

171171
}
172172

173-
//returns all nodes attached to a specific clusters, used to detach all nodes from clusters
173+
// returns all nodes attached to a specific clusters, used to detach all nodes from clusters
174174
func getAllClusterNodes(allNodes []qbert.Node, clusters []string) []qbert.Node {
175175

176176
var clusterNodes []qbert.Node

pkg/util/helper.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ func RetryPolicyOn404(ctx context.Context, resp *http.Response, err error) (bool
3838
if v, ok := err.(*url.Error); ok {
3939
// Don't retry if the error was due to too many redirects.
4040
if redirectsErrorRe.MatchString(v.Error()) {
41-
return false, nil
41+
return false, err
4242
}
4343

4444
// Don't retry if the error was due to an invalid protocol scheme.
4545
if schemeErrorRe.MatchString(v.Error()) {
46-
return false, nil
46+
return false, err
4747
}
4848

4949
// Don't retry if the error was due to TLS cert verification failure.
5050
if _, ok := v.Err.(x509.UnknownAuthorityError); ok {
51-
return false, nil
51+
return false, err
5252
}
5353
}
5454

@@ -73,7 +73,7 @@ func RetryPolicyOn404(ctx context.Context, resp *http.Response, err error) (bool
7373
return true, nil
7474
}
7575

76-
return false, nil
76+
return false, err
7777
}
7878

7979
// AskBool function asks for the user input

0 commit comments

Comments
 (0)