Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[App Service]: Fix #17424: az appservice plan show: Provide correct exit status #18994

Merged
merged 8 commits into from
Jul 30, 2021
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def load_command_table(self, _):
exception_handler=ex_handler_factory(creating_plan=True))
g.command('delete', 'delete', confirmation=True)
g.custom_command('list', 'list_app_service_plans')
g.show_command('show', 'get')
g.custom_show_command('show', 'show_plan')
g.generic_update_command('update', setter_name='begin_create_or_update', custom_func_name='update_app_service_plan',
setter_arg_name='app_service_plan', supports_no_wait=True,
exception_handler=ex_handler_factory())
Expand Down
11 changes: 11 additions & 0 deletions src/azure-cli/azure/cli/command_modules/appservice/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1703,6 +1703,17 @@ def update_app_service_plan(instance, sku=None, number_of_workers=None):
return instance


def show_plan(cmd, resource_group_name, name):
from azure.cli.core.commands.client_factory import get_subscription_id
client = web_client_factory(cmd.cli_ctx)
serverfarm_url_base = 'subscriptions/{}/resourceGroups/{}/providers/Microsoft.Web/serverfarms/{}?api-version={}'
subscription_id = get_subscription_id(cmd.cli_ctx)
serverfarm_url = serverfarm_url_base.format(subscription_id, resource_group_name, name, client.DEFAULT_API_VERSION)
request_url = cmd.cli_ctx.cloud.endpoints.resource_manager + serverfarm_url
response = send_raw_request(cmd.cli_ctx, "GET", request_url)
return response.json()


def update_functionapp_app_service_plan(cmd, instance, sku=None, number_of_workers=None, max_burst=None):
instance = update_app_service_plan(instance, sku, number_of_workers)
if max_burst is not None:
Expand Down
Loading