remove unregister cloud first

This commit is contained in:
MoChilia
2024-06-18 17:05:25 +08:00
parent ca0c27b734
commit 0df14e308f
2 changed files with 16 additions and 16 deletions

View File

@@ -4037,14 +4037,14 @@ class AzureCliLogin {
if (!this.loginConfig.resourceManagerEndpointUrl) {
throw new Error("resourceManagerEndpointUrl is a required parameter when environment is defined.");
}
core.info(`Unregistering cloud: "${this.loginConfig.environment}" first if it exists`);
try {
yield this.executeAzCliCommand(["cloud", "set", "-n", "AzureCloud"], true);
yield this.executeAzCliCommand(["cloud", "unregister", "-n", this.loginConfig.environment], false);
}
catch (error) {
core.info(`Ignore cloud not registered error: "${error}"`);
}
// core.info(`Unregistering cloud: "${this.loginConfig.environment}" first if it exists`);
// try {
// await this.executeAzCliCommand(["cloud", "set", "-n", "AzureCloud"], true);
// await this.executeAzCliCommand(["cloud", "unregister", "-n", this.loginConfig.environment], false);
// }
// catch (error) {
// core.info(`Ignore cloud not registered error: "${error}"`);
// }
core.info(`Registering cloud: "${this.loginConfig.environment}" with ARM endpoint: "${this.loginConfig.resourceManagerEndpointUrl}"`);
try {
let baseUri = this.loginConfig.resourceManagerEndpointUrl;

View File

@@ -67,14 +67,14 @@ export class AzureCliLogin {
throw new Error("resourceManagerEndpointUrl is a required parameter when environment is defined.");
}
core.info(`Unregistering cloud: "${this.loginConfig.environment}" first if it exists`);
try {
await this.executeAzCliCommand(["cloud", "set", "-n", "AzureCloud"], true);
await this.executeAzCliCommand(["cloud", "unregister", "-n", this.loginConfig.environment], false);
}
catch (error) {
core.info(`Ignore cloud not registered error: "${error}"`);
}
// core.info(`Unregistering cloud: "${this.loginConfig.environment}" first if it exists`);
// try {
// await this.executeAzCliCommand(["cloud", "set", "-n", "AzureCloud"], true);
// await this.executeAzCliCommand(["cloud", "unregister", "-n", this.loginConfig.environment], false);
// }
// catch (error) {
// core.info(`Ignore cloud not registered error: "${error}"`);
// }
core.info(`Registering cloud: "${this.loginConfig.environment}" with ARM endpoint: "${this.loginConfig.resourceManagerEndpointUrl}"`);
try {