Skip to content

Commit

Permalink
Fix auth error regressions
Browse files Browse the repository at this point in the history
  • Loading branch information
wezhang committed Nov 22, 2018
1 parent a6018c6 commit 7c88f47
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,6 @@ public AuthResult signIn(@Nullable AuthResult savedAuth) throws IOException {
// Swallow the exception since some provided environments are not full featured
LOGGER.warning("Can't get " + env.resourceManagerEndpoint() + " access token from environment " +
CommonSettings.getEnvironment().getName());
} else {
throw e;
}
}

Expand All @@ -188,8 +186,6 @@ public AuthResult signIn(@Nullable AuthResult savedAuth) throws IOException {
// Swallow the exception since some provided environments are not full featured
LOGGER.warning("Can't get " + env.graphEndpoint() + " access token from environment " +
CommonSettings.getEnvironment().getName());
} else {
throw e;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@
import com.microsoft.azuretools.utils.AzureRegisterProviderNamespaces;
import com.microsoft.azuretools.utils.Pair;
import com.microsoft.rest.credentials.ServiceClientCredentials;
import rx.Observable;

import java.io.IOException;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.logging.Logger;
Expand Down Expand Up @@ -113,12 +115,30 @@ public Settings getSettings() {
}

public static List<Subscription> getSubscriptions(String tid) throws IOException {
List<Subscription> sl = authTid(tid).subscriptions().list();
List<Subscription> sl = authTid(tid).subscriptions().listAsync()
.onErrorResumeNext(err -> {
LOGGER.warning(err.getMessage());

return Observable.empty();
})
.toList()
.toBlocking()
.singleOrDefault(Collections.emptyList());

return sl;
}

public static List<Tenant> getTenants(String tid) throws IOException {
List<Tenant> tl = authTid(tid).tenants().list();
List<Tenant> tl = authTid(tid).tenants().listAsync()
.onErrorResumeNext(err -> {
LOGGER.warning(err.getMessage());

return Observable.empty();
})
.toList()
.toBlocking()
.singleOrDefault(Collections.emptyList());

return tl;
}

Expand Down

0 comments on commit 7c88f47

Please sign in to comment.