Skip to content

Commit

Permalink
Fix location
Browse files Browse the repository at this point in the history
  • Loading branch information
snehapar9 committed Nov 11, 2023
1 parent 3d42700 commit 145abc7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
17 changes: 8 additions & 9 deletions azurecontainerapps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,17 +234,16 @@ export class azurecontainerapps {
let location: string = this.toolHelper.getInput('location', false);
let resourceGroup: string = this.toolHelper.getInput('resourceGroup', false);

if (!this.util.isNullOrEmpty(resourceGroup)) {
let doesContainerAppExist = await this.appHelper.doesContainerAppExist(this.containerAppName, resourceGroup);
if (doesContainerAppExist) {
var environmentName = await this.appHelper.getExistingContainerAppEnvironmentName(this.containerAppName, resourceGroup);
location = await this.appHelper.getExistingContainerAppEnvironmentLocation(environmentName, resourceGroup);
}
}

// If no location was provided, use the default location for the Container App service
if (this.util.isNullOrEmpty(location)) {
location = await this.appHelper.getDefaultContainerAppLocation();
if (!this.util.isNullOrEmpty(resourceGroup)) {
let doesContainerAppExist = await this.appHelper.doesContainerAppExist(this.containerAppName, resourceGroup);
if (doesContainerAppExist) {
var environmentName = await this.appHelper.getExistingContainerAppEnvironmentName(this.containerAppName, resourceGroup);
location = await this.appHelper.getExistingContainerAppEnvironmentLocation(environmentName, resourceGroup);
}
}
// location = await this.appHelper.getDefaultContainerAppLocation();
}

return location;
Expand Down
9 changes: 2 additions & 7 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ var azurecontainerapps = /** @class */ (function () {
case 0:
location = this.toolHelper.getInput('location', false);
resourceGroup = this.toolHelper.getInput('resourceGroup', false);
if (!this.util.isNullOrEmpty(location)) return [3 /*break*/, 4];
if (!!this.util.isNullOrEmpty(resourceGroup)) return [3 /*break*/, 4];
return [4 /*yield*/, this.appHelper.doesContainerAppExist(this.containerAppName, resourceGroup)];
case 1:
Expand All @@ -274,13 +275,7 @@ var azurecontainerapps = /** @class */ (function () {
case 3:
location = _a.sent();
_a.label = 4;
case 4:
if (!this.util.isNullOrEmpty(location)) return [3 /*break*/, 6];
return [4 /*yield*/, this.appHelper.getDefaultContainerAppLocation()];
case 5:
location = _a.sent();
_a.label = 6;
case 6: return [2 /*return*/, location];
case 4: return [2 /*return*/, location];
}
});
});
Expand Down

0 comments on commit 145abc7

Please sign in to comment.