Skip to content

Commit

Permalink
Add validation for az webapp scale (#6756)
Browse files Browse the repository at this point in the history
  • Loading branch information
Juliehzl authored Sep 15, 2023
1 parent ca53b85 commit 1d77264
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@

/src/kusto/ @ilayr @orhasban @astauben

/src/appservice-kube/ @ebencarek @calcha @StrawnSC
/src/appservice-kube/ @ebencarek @howang-ms @Juliehzl @LaylaLiu-gmail

/src/custom-providers/ @jsntcy

Expand Down
4 changes: 4 additions & 0 deletions src/appservice-kube/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
Release History
===============
0.1.9
++++++
* `az webapp scale`: Add validation to reject non-arc enabled app service

0.1.8
++++++
* Fix appservice kube - No module named 'azure.mgmt.web.v2021_01_01'
Expand Down
2 changes: 1 addition & 1 deletion src/appservice-kube/azext_appservice_kube/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

helps['webapp scale'] = """
type: command
short-summary: Modify the number of instances of a webapp.
short-summary: Modify the number of instances of a webapp on Arc enabled Kubernetes workloads .
examples:
- name: Change the number of instances of MyApp to 2.
text: >
Expand Down
4 changes: 4 additions & 0 deletions src/appservice-kube/azext_appservice_kube/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,10 @@ def set_webapp(cmd, resource_group_name, name, slot=None, **kwargs): # pylint:


def scale_webapp(cmd, resource_group_name, name, instance_count, slot=None):
client = web_client_factory(cmd.cli_ctx)
webapp = client.web_apps.get(resource_group_name, name)
if not webapp.extended_location:
raise ValidationError("The web app {} is not on Arc enabled Kubernetes. Please use `az appservice plan update` to scale for non-arc enabled app service.".format(name))
return update_site_configs(cmd, resource_group_name, name,
number_of_workers=instance_count, slot=slot)

Expand Down
2 changes: 1 addition & 1 deletion src/appservice-kube/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# TODO: Confirm this is the right version number you want and it matches your
# HISTORY.rst entry.
VERSION = '0.1.8'
VERSION = '0.1.9'

# The full list of classifiers is available at
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
Expand Down

0 comments on commit 1d77264

Please sign in to comment.