Skip to content

Commit

Permalink
Fix the regex
Browse files Browse the repository at this point in the history
  • Loading branch information
mukhoakash committed Aug 27, 2024
1 parent 3b36dc9 commit 06a2266
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -414,12 +414,15 @@ def get_desired_resource_value_args(
# Returns -1 if there is a problem with parsing the vm_size.
def get_cores_from_sku(vm_size):
cpu_value = -1
pattern = r'(\d+)([a-z])*(?=_v(\d+)[^_]*$|$)'
pattern = r'([a-z])+(\d+)[a-z]*(?=_v(\d+)[^_]*$|$)'
match = re.search(pattern, vm_size.lower())
if match:
series_prefix = match.group(1)
size_val = int(match.group(2))
version = int(match.group(3))
version_val = match.group(3)
version = -1
if version_val is not None:
version = int(version_val)

cpu_value = size_val
# https://learn.microsoft.com/en-us/azure/virtual-machines/dv2-dsv2-series
Expand Down

0 comments on commit 06a2266

Please sign in to comment.