Skip to content

Commit 7c88f47

Browse files
committed
Fix auth error regressions
1 parent a6018c6 commit 7c88f47

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

Utils/azuretools-core/src/com/microsoft/azuretools/authmanage/AdAuthManager.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,6 @@ public AuthResult signIn(@Nullable AuthResult savedAuth) throws IOException {
176176
// Swallow the exception since some provided environments are not full featured
177177
LOGGER.warning("Can't get " + env.resourceManagerEndpoint() + " access token from environment " +
178178
CommonSettings.getEnvironment().getName());
179-
} else {
180-
throw e;
181179
}
182180
}
183181

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

Utils/azuretools-core/src/com/microsoft/azuretools/sdkmanage/AccessTokenAzureManager.java

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@
3939
import com.microsoft.azuretools.utils.AzureRegisterProviderNamespaces;
4040
import com.microsoft.azuretools.utils.Pair;
4141
import com.microsoft.rest.credentials.ServiceClientCredentials;
42+
import rx.Observable;
4243

4344
import java.io.IOException;
45+
import java.util.Collections;
4446
import java.util.LinkedList;
4547
import java.util.List;
4648
import java.util.logging.Logger;
@@ -113,12 +115,30 @@ public Settings getSettings() {
113115
}
114116

115117
public static List<Subscription> getSubscriptions(String tid) throws IOException {
116-
List<Subscription> sl = authTid(tid).subscriptions().list();
118+
List<Subscription> sl = authTid(tid).subscriptions().listAsync()
119+
.onErrorResumeNext(err -> {
120+
LOGGER.warning(err.getMessage());
121+
122+
return Observable.empty();
123+
})
124+
.toList()
125+
.toBlocking()
126+
.singleOrDefault(Collections.emptyList());
127+
117128
return sl;
118129
}
119130

120131
public static List<Tenant> getTenants(String tid) throws IOException {
121-
List<Tenant> tl = authTid(tid).tenants().list();
132+
List<Tenant> tl = authTid(tid).tenants().listAsync()
133+
.onErrorResumeNext(err -> {
134+
LOGGER.warning(err.getMessage());
135+
136+
return Observable.empty();
137+
})
138+
.toList()
139+
.toBlocking()
140+
.singleOrDefault(Collections.emptyList());
141+
122142
return tl;
123143
}
124144

0 commit comments

Comments
 (0)