Skip to content

Commit

Permalink
[Spring] Upgrade check to GA plan (#4958)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuwzho authored Jun 13, 2022
1 parent d7f8bee commit 61a2e64
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
11 changes: 11 additions & 0 deletions src/spring/azext_spring/_constant.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

# pylint: disable=wrong-import-order
# pylint: disable=unused-argument, logging-format-interpolation, protected-access, wrong-import-order, too-many-lines

MARKETPLACE_OFFER_ID = 'azure-spring-cloud-vmware-tanzu-2'
MARKETPLACE_PUBLISHER_ID = 'vmware-inc'
MARKETPLACE_PLAN_ID = 'asa-ent-hr-mtr'
15 changes: 9 additions & 6 deletions src/spring/azext_spring/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from knack.log import get_logger
from ._utils import (ApiType, _get_rg_location, _get_file_type, _get_sku_name)
from .vendored_sdks.appplatform.v2020_07_01 import models
from ._constant import (MARKETPLACE_OFFER_ID, MARKETPLACE_PLAN_ID, MARKETPLACE_PUBLISHER_ID)

logger = get_logger(__name__)

Expand Down Expand Up @@ -70,14 +71,16 @@ def _validate_terms(cmd, namespace):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
client = get_mgmt_service_client(cmd.cli_ctx, MarketplaceOrderingAgreements).marketplace_agreements
term = client.get(offer_type="virtualmachine",
publisher_id='vmware-inc',
offer_id='azure-spring-cloud-vmware-tanzu-2',
plan_id='tanzu-asc-ent-mtr')
publisher_id=MARKETPLACE_PUBLISHER_ID,
offer_id=MARKETPLACE_OFFER_ID,
plan_id=MARKETPLACE_PLAN_ID)
if not term.accepted:
raise InvalidArgumentValueError('Terms for Azure Spring Apps Enterprise is not accepted.\n'
'Run "az term accept --publisher vmware-inc '
'--product azure-spring-cloud-vmware-tanzu-2 '
'--plan tanzu-asc-ent-mtr" to accept the term.')
'Run "az term accept --publisher {} '
'--product {} '
'--plan {}" to accept the term.'.format(MARKETPLACE_PUBLISHER_ID,
MARKETPLACE_OFFER_ID,
MARKETPLACE_PLAN_ID))


def _check_tanzu_components_not_enable(cmd, namespace):
Expand Down

0 comments on commit 61a2e64

Please sign in to comment.