Skip to content

Commit 2740ed5

Browse files
authored
fix(gcp): fixing existing test + adding one test and updating credentials.json (#10166)
1 parent 824e0e5 commit 2740ed5

File tree

5 files changed

+204
-14
lines changed

5 files changed

+204
-14
lines changed

packages/google/src/instance/gceInstanceType.service.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -400,9 +400,16 @@ module(GOOGLE_INSTANCE_GCEINSTANCETYPE_SERVICE, []).factory('gceInstanceTypeServ
400400
}
401401

402402
function getAvailableTypesForLocations(locationToInstanceTypesMap, selectedLocations) {
403-
// This function is only ever called with one location.
404-
const [location] = selectedLocations;
405-
return locationToInstanceTypesMap[location].instanceTypes;
403+
if (!locationToInstanceTypesMap || !selectedLocations || selectedLocations.length === 0) {
404+
console.error('Invalid input parameters');
405+
return [];
406+
}
407+
408+
const availableTypes = selectedLocations
409+
.filter((location) => locationToInstanceTypesMap[location])
410+
.flatMap((location) => locationToInstanceTypesMap[location].instanceTypes || []);
411+
412+
return availableTypes;
406413
}
407414

408415
const getAvailableTypesForRegions = getAvailableTypesForLocations;

packages/google/src/serverGroup/configure/serverGroupConfiguration.service.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ angular
234234
const c = command;
235235
const result = { dirty: {} };
236236

237-
const locations = c.regional ? [c.region] : [c.zone];
237+
const locations = c.regional ? c.distributionPolicy.zones : [c.zone];
238238
const { credentialsKeyedByAccount } = c.backingData;
239239
const { locationToInstanceTypesMap } = credentialsKeyedByAccount[c.credentials];
240240

0 commit comments

Comments
 (0)