Skip to content

Commit

Permalink
fix(pci-instances): use os flavor for license pricing
Browse files Browse the repository at this point in the history
ref: TAPC-2720

Signed-off-by: Simon Chaumet <[email protected]>
  • Loading branch information
SimonChaumet committed Jan 31, 2025
1 parent 755b1fe commit 21b11e2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ export default class FlavorsList {
const groupedPlanCodesByName = groupBy(hourlyPlanCodes, 'name');

return map(groupedPlanCodesByName, (groupedFlavors) => {
const resource = groupedFlavors.find(
(groupedFlavor) => !groupedFlavor?.region?.includes('LZ'),
);
const resource = groupedFlavors[0];
const planCodeList = groupedFlavors.map(
(flavor) => flavor.planCodes.hourly,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1839,24 +1839,17 @@ export default class PciInstancesAddController {
return false;
}

const isWindowsDistribution = Boolean(distribution.match(/^windows/i));
const hasWindowsServerImages =
isWindowsDistribution &&
images.some(({ name }) => name.match(/20(16|19|22)/));
const isLicensedFlavor = Boolean(
const flavor = flavorGroup.getFlavorByOsType('windows');

return (
flavor &&
Boolean(distribution.match(/^windows/i)) &&
images.some(({ name }) => name.match(/20(16|19|22)/)) &&
this.catalog.addons
.find(({ planCode }) => planCode === flavorGroup?.planCodes.hourly)
.find(({ planCode }) => planCode === flavor.planCodes.hourly)
?.addonFamilies.some(({ addons }) =>
addons.includes(WINDOWS_GEN_3_ADDON_PLANCODE),
),
);
const is1AZRegion = !this.isLocalZone();

return (
isWindowsDistribution &&
hasWindowsServerImages &&
isLicensedFlavor &&
is1AZRegion
)
);
}

Expand Down

0 comments on commit 21b11e2

Please sign in to comment.