mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-17 04:18:07 +00:00
handle SkuNotAvailable errors when creating VM Scalesets (#557)
This commit is contained in:
@ -8,7 +8,7 @@ import os
|
|||||||
from typing import Any, Dict, List, Optional, Union, cast
|
from typing import Any, Dict, List, Optional, Union, cast
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
from azure.core.exceptions import ResourceNotFoundError
|
from azure.core.exceptions import ResourceExistsError, ResourceNotFoundError
|
||||||
from azure.mgmt.compute.models import (
|
from azure.mgmt.compute.models import (
|
||||||
ResourceSku,
|
ResourceSku,
|
||||||
ResourceSkuRestrictionsType,
|
ResourceSkuRestrictionsType,
|
||||||
@ -321,6 +321,12 @@ def create_vmss(
|
|||||||
compute_client.virtual_machine_scale_sets.begin_create_or_update(
|
compute_client.virtual_machine_scale_sets.begin_create_or_update(
|
||||||
resource_group, name, params
|
resource_group, name, params
|
||||||
)
|
)
|
||||||
|
except ResourceExistsError as err:
|
||||||
|
if "SkuNotAvailable" in repr(err):
|
||||||
|
return Error(
|
||||||
|
code=ErrorCode.VM_CREATE_FAILED, errors=["creating vmss: %s" % err]
|
||||||
|
)
|
||||||
|
raise err
|
||||||
except (ResourceNotFoundError, CloudError) as err:
|
except (ResourceNotFoundError, CloudError) as err:
|
||||||
if "The request failed due to conflict with a concurrent request" in repr(err):
|
if "The request failed due to conflict with a concurrent request" in repr(err):
|
||||||
logging.debug(
|
logging.debug(
|
||||||
|
Reference in New Issue
Block a user