Azure / azure-cli

Azure Command-Line Interface
MIT License
3.97k stars 2.95k forks source link

appservice: show/list command doesn't get linux typed webapps or functionapps #4890

Closed yugangw-msft closed 6 years ago

yugangw-msft commented 6 years ago

With new app types added for linux like app,linux and functionapp,linux, the get/list command gets out of sync, because it still filter using old types of app and functionapp

josalem commented 6 years ago

This local validation code is blocking Azure Web Apps for Containers from being listed or shown:

FUNCTION_APP_TYPES = ['functionapp', 'functionapp,linux']
WEB_APP_TYPES = ['app', 'app,linux']

def validate_existing_function_app(cmd, namespace):
    _validate_existing_app(cmd.cli_ctx, namespace, FUNCTION_APP_TYPES)

def validate_existing_web_app(cmd, namespace):
    _validate_existing_app(cmd.cli_ctx, namespace, WEB_APP_TYPES)

def _validate_existing_app(cli_ctx, namespace, app_type):
    client = web_client_factory(cli_ctx)
    instance = client.web_apps.get(namespace.resource_group_name, namespace.name)
    if instance.kind not in app_type:  # pylint: disable=no-member
        raise CLIError('Usage Error: {} is not a correct app type'.format(namespace.name))
    setattr(namespace, 'app_instance', instance)

The kind for Web Apps for Containers is 'app,linux,container'. Any new web app types, e.g., web apps for containers and Azure Functions Containers, will appear "broken" from a CLI end user perspective until this array is updated to include the correct kind values. Users will receive the 'Usage Error: {} is not a correct app type' message for (at least) webapp list and webapp show if their webapp is container based. Is there a more dynamic way to perform this client side validation? Is this client side validation necessary?

yugangw-msft commented 6 years ago

@josalem, I will remove the client logics considering the webapp back-end service is continuously changing w/o notifications // cc: @ahmedelnably @panchagnula

yugangw-msft commented 6 years ago

The change was in. You can verify through docker: docker run -v ${HOME}:/root -it azuresdk/azure-cli-python:dev

josalem commented 6 years ago

Verified fixed via prompt.ws for #5335 .