Skip to content

Commit

Permalink
Fixing style errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rkaraddi committed Apr 25, 2024
1 parent 382bef7 commit 7fa4fb2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 0 additions & 2 deletions src/aosm/azext_aosm/common/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ class ManifestsExist(str, Enum):
NONE = "none"
SOME = "some"

class BaseResourcesExist:
BASE_RESOURCES_EXIST = False

CNF_TYPE = "ContainerizedNetworkFunction"
VNF_TYPE = "VirtualNetworkFunction"
Expand Down
24 changes: 13 additions & 11 deletions src/aosm/azext_aosm/definition_folder/reader/bicep_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@
from knack.log import get_logger
from azext_aosm.common.command_context import CommandContext
from azext_aosm.common.utils import convert_bicep_to_arm
from azext_aosm.configuration_models.common_parameters_config import \
BaseCommonParametersConfig, CoreVNFCommonParametersConfig, NFDCommonParametersConfig, NexusVNFCommonParametersConfig, NSDCommonParametersConfig
from azext_aosm.configuration_models.common_parameters_config import (
BaseCommonParametersConfig,
CoreVNFCommonParametersConfig,
NFDCommonParametersConfig,
NSDCommonParametersConfig
)
from azext_aosm.definition_folder.reader.base_definition import \
BaseDefinitionElement
from azext_aosm.common.constants import (
ManifestsExist,
BaseResourcesExist,)
)

logger = get_logger(__name__)

Expand Down Expand Up @@ -158,7 +162,7 @@ def _artifact_manifests_exist(
@staticmethod
def _base_Resources_exist(
config: BaseCommonParametersConfig, command_context: CommandContext
) -> BaseResourcesExist:
) -> bool:
"""
Returns True if all required manifests exist, False if none do, and raises an
Expand All @@ -167,7 +171,6 @@ def _base_Resources_exist(
Current code only allows one manifest for ACR, and one manifest for SA (if applicable),
so that's all we check for.
"""
base_resources_exist = BaseResourcesExist.BASE_RESOURCES_EXIST
try:
command_context.aosm_client.publishers.get(
resource_group_name=config.publisherResourceGroupName,
Expand All @@ -186,7 +189,7 @@ def _base_Resources_exist(
base_resources_exist = True
except azure_exceptions.ResourceNotFoundError:
base_resources_exist = False

if isinstance(config, NFDCommonParametersConfig):
try:
command_context.aosm_client.network_function_definition_groups.get(
Expand All @@ -197,7 +200,7 @@ def _base_Resources_exist(
base_resources_exist = True
except azure_exceptions.ResourceNotFoundError:
base_resources_exist = False

if isinstance(config, CoreVNFCommonParametersConfig):
try:
command_context.aosm_client.artifact_stores.get(
Expand All @@ -208,7 +211,7 @@ def _base_Resources_exist(
base_resources_exist = True
except azure_exceptions.ResourceNotFoundError:
base_resources_exist = False

if isinstance(config, NSDCommonParametersConfig):
try:
command_context.aosm_client.network_service_design_groups.get(
Expand All @@ -220,8 +223,7 @@ def _base_Resources_exist(
except azure_exceptions.ResourceNotFoundError:
base_resources_exist = False

BaseResourcesExist.BASE_RESOURCES_EXIST = base_resources_exist
return BaseResourcesExist
return base_resources_exist

def deploy(
self, config: BaseCommonParametersConfig, command_context: CommandContext
Expand All @@ -242,7 +244,7 @@ def deploy(
base_resources_exist = self._base_Resources_exist(
config=config, command_context=command_context
)
if base_resources_exist.BASE_RESOURCES_EXIST:
if base_resources_exist:
logger.info("Base resources already exist; skipping deployment.")
return

Expand Down

0 comments on commit 7fa4fb2

Please sign in to comment.