mirror of https://github.com/apache/jclouds.git
retry on user auth exception when flag set
This commit is contained in:
parent
6392edfcee
commit
6b2cfa7f3a
|
@ -378,7 +378,7 @@ public class SshjSshClient implements SshClient {
|
|||
@VisibleForTesting
|
||||
boolean shouldRetry(Exception from) {
|
||||
Predicate<Throwable> predicate = retryAuth ? Predicates.<Throwable> or(retryPredicate,
|
||||
instanceOf(AuthorizationException.class)) : retryPredicate;
|
||||
instanceOf(AuthorizationException.class), instanceOf(UserAuthException.class)) : retryPredicate;
|
||||
if (any(getCausalChain(from), predicate))
|
||||
return true;
|
||||
if (!retryableMessages.equals(""))
|
||||
|
|
|
@ -99,8 +99,10 @@ public class SshjSshClientTest {
|
|||
public void testOnlyRetryAuthWhenSet() {
|
||||
SshjSshClient ssh1 = createClient();
|
||||
assert !ssh1.shouldRetry(new AuthorizationException("problem", null));
|
||||
assert !ssh1.shouldRetry(new UserAuthException("problem", null));
|
||||
ssh1.retryAuth = true;
|
||||
assert ssh1.shouldRetry(new AuthorizationException("problem", null));
|
||||
assert ssh1.shouldRetry(new UserAuthException("problem", null));
|
||||
}
|
||||
|
||||
public void testOnlyRetryAuthWhenSetViaProperties() {
|
||||
|
@ -108,6 +110,7 @@ public class SshjSshClientTest {
|
|||
props.setProperty("jclouds.ssh.retry-auth", "true");
|
||||
SshjSshClient ssh1 = createClient(props);
|
||||
assert ssh1.shouldRetry(new AuthorizationException("problem", null));
|
||||
assert ssh1.shouldRetry(new UserAuthException("problem", null));
|
||||
}
|
||||
|
||||
public void testExceptionMessagesRetry() {
|
||||
|
|
Loading…
Reference in New Issue