Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ def load_arguments(self, _):
subscription than the app service environment, please use the resource ID for --app-service-environment parameter. ",
local_context_attribute=LocalContextAttribute(name='ase_name', actions=[LocalContextAction.GET]))
c.argument('sku', arg_type=sku_arg_type)
c.argument('is_linux', action='store_true', required=False, help='host web app on Linux worker')
c.argument('is_linux', arg_type=get_three_state_flag(), default=None, required=False,
help='Host web app on Linux worker. Defaults to true unless --hyper-v is specified. '
'Use "--is-linux false" to create a Windows plan.')
c.argument('hyper_v', action='store_true', required=False, help='Host Windows Container Web App on Hyper-V worker.')
c.argument('per_site_scaling', action='store_true', required=False, help='Enable per-app scaling at the '
'App Service plan level to allow for '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ def _validate_asp_sku(sku, app_service_environment, zone_redundant):

def validate_asp_create(namespace):
validate_tags(namespace)
# is_linux is None when not explicitly provided by the user (default).
# Resolve the default: Linux unless --hyper-v is specified.
if namespace.is_linux is None:
namespace.is_linux = not namespace.hyper_v
elif namespace.is_linux and namespace.hyper_v:
raise MutuallyExclusiveArgumentError('Usage error: --is-linux true and --hyper-v cannot be used together.')
if namespace.sku is None:
if namespace.is_linux:
namespace.sku = 'P0V3'
Expand All @@ -120,8 +126,6 @@ def validate_asp_create(namespace):
namespace.sku = 'B1'
sku = _normalize_sku(namespace.sku)
_validate_asp_sku(sku, namespace.app_service_environment, namespace.zone_redundant)
if namespace.is_linux and namespace.hyper_v:
raise MutuallyExclusiveArgumentError('Usage error: --is-linux and --hyper-v cannot be used together.')


def validate_functionapp_asp_create(namespace):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
retryable_method,
raise_missing_token_suggestion,
_get_location_from_resource_group,
_list_app,
is_functionapp,
is_linux_webapp,
_rename_server_farm_props,
Expand Down Expand Up @@ -4921,6 +4920,13 @@ def create_app_service_plan(cmd, resource_group_name, name, is_linux, hyper_v, p
is_managed_instance=None, mi_system_assigned=None, mi_user_assigned=None,
default_identity=None, rdp_enabled=None, vnet=None, subnet=None,
registry_adapters=None, install_scripts=None, storage_mounts=None):
if is_linux is None:
is_linux = not hyper_v
elif is_linux and hyper_v:
raise MutuallyExclusiveArgumentError('--hyper-v creates a Windows container plan and cannot be combined '
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be confusing. It says "--hyper-v ... cannot be combined with --is-linux" and then instructs the user to combine them ("--is-linux false --hyper-v").

Two options:

  1. Add "true" to the constraint: "--hyper-v creates a Windows container plan and cannot be combined with --is-linux true."
  2. Reword the fix instruction: "Omit --is-linux or pass --is-linux false."

Non blocking, feel free to resolve!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing it Vandana. Making it to something like below (as suggested in point 1)

"--hyper-v creates a Windows container plan and cannot be combined with --is-linux true."

'with --is-linux. Use "--is-linux false --hyper-v" to create a '
'Windows container plan.')

if sku is None:
sku = 'P0V3' if is_linux else 'B1'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: because we are changing the default behavior, we might want to log warning about the OS and Sku of the app service plan before actually requesting and starting the app service plan creation (around line 5018? AppServicePlanCreateWithNoWait())
Right now, we only log the OS information around line 5044 (after request to create) and the user will see all the other details of their plan after it is created. But correct me if I'm wrong. This might be useful for agents/users to cancel before it is created.


Expand Down
Loading