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

WebApp:az webapp config appsettings fails when using az-cli docker container alias #18820

Closed
eseyden opened this issue Jul 12, 2021 · 5 comments
Labels
app-service-linux-containers Service Attention This issue is responsible by Azure service team. Web Apps az webapp

Comments

@eseyden
Copy link

eseyden commented Jul 12, 2021

This is autogenerated. Please review and update as needed.

Describe the bug

I used this alias to provide the az environment
alias az='docker run -it --entrypoint /usr/local/bin/az -v /Users/eseyden/.azure:/root/.azure -v /Users/eseyden/.ssh:/root/.ssh mcr.microsoft.com/azure-cli'

Oddly enough this does not happen when using the bash terminal the container provides or system installed zsh on MacOS 11 , but duplicates the bug my associate runs into from their linux terminal.

Command Name
az webapp config appsettings set

flag that triggered error --settings ENVIRONMENT_VARIABLE=ARelativelyLongSecret33824842

Errors:

The command failed with an unexpected error. Here is the traceback:
'NoneType' object has no attribute 'lower'
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/util.py", line 506, in shell_safe_json_parse
    return json.loads(json_or_dict_string, strict=strict)
  File "/usr/local/lib/python3.8/json/__init__.py", line 370, in loads
    return cls(**kw).decode(s)
  File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/util.py", line 512, in shell_safe_json_parse
    return ast.literal_eval(json_or_dict_string)
  File "/usr/local/lib/python3.8/ast.py", line 59, in literal_eval
    node_or_string = parse(node_or_string, mode='eval')
  File "/usr/local/lib/python3.8/ast.py", line 47, in parse
    return compile(source, filename, mode, flags,
  File "<unknown>", line 1
    INSTAGRAM_CLIENT_ID=(redacted)
                       ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 657, in execute
    raise ex
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 691, in _run_job
    result = cmd_copy(params)
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/usr/local/lib/python3.8/site-packages/azure/cli/command_modules/appservice/custom.py", line 260, in update_app_settings
    temp = shell_safe_json_parse(s)
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/util.py", line 525, in shell_safe_json_parse
    parent_proc = get_parent_proc_name().lower()
AttributeError: 'NoneType' object has no attribute 'lower'

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here...
  • az webapp config appsettings set --name {} --resource-group {} --settings {}

Expected Behavior

Set an environment setting on webapp

Environment Summary

Linux-5.10.25-linuxkit-x86_64-with
Python 3.8.9
Installer: DOCKER

azure-cli 2.26.0

Additional Context

@ghost ghost added needs-triage This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that customer-reported Issues that are reported by GitHub users external to the Azure organization. labels Jul 12, 2021
@yonzhan yonzhan added the Web Apps az webapp label Jul 12, 2021
@ghost ghost removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Jul 12, 2021
@yonzhan yonzhan added Service Attention This issue is responsible by Azure service team. and removed customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jul 12, 2021
@ghost
Copy link

ghost commented Jul 12, 2021

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @AzureAppServiceCLI, @antcp.

Issue Details

This is autogenerated. Please review and update as needed.

Describe the bug

I used this alias to provide the az environment
alias az='docker run -it --entrypoint /usr/local/bin/az -v /Users/eseyden/.azure:/root/.azure -v /Users/eseyden/.ssh:/root/.ssh mcr.microsoft.com/azure-cli'

Oddly enough this does not happen when using the bash terminal the container provides or system installed zsh on MacOS 11 , but duplicates the bug my associate runs into from their linux terminal.

Command Name
az webapp config appsettings set

flag that triggered error --settings ENVIRONMENT_VARIABLE=ARelativelyLongSecret33824842

Errors:

The command failed with an unexpected error. Here is the traceback:
'NoneType' object has no attribute 'lower'
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/util.py", line 506, in shell_safe_json_parse
    return json.loads(json_or_dict_string, strict=strict)
  File "/usr/local/lib/python3.8/json/__init__.py", line 370, in loads
    return cls(**kw).decode(s)
  File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/util.py", line 512, in shell_safe_json_parse
    return ast.literal_eval(json_or_dict_string)
  File "/usr/local/lib/python3.8/ast.py", line 59, in literal_eval
    node_or_string = parse(node_or_string, mode='eval')
  File "/usr/local/lib/python3.8/ast.py", line 47, in parse
    return compile(source, filename, mode, flags,
  File "<unknown>", line 1
    INSTAGRAM_CLIENT_ID=(redacted)
                       ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 657, in execute
    raise ex
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 691, in _run_job
    result = cmd_copy(params)
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/usr/local/lib/python3.8/site-packages/azure/cli/command_modules/appservice/custom.py", line 260, in update_app_settings
    temp = shell_safe_json_parse(s)
  File "/usr/local/lib/python3.8/site-packages/azure/cli/core/util.py", line 525, in shell_safe_json_parse
    parent_proc = get_parent_proc_name().lower()
AttributeError: 'NoneType' object has no attribute 'lower'

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here...
  • az webapp config appsettings set --name {} --resource-group {} --settings {}

Expected Behavior

Set an environment setting on webapp

Environment Summary

Linux-5.10.25-linuxkit-x86_64-with
Python 3.8.9
Installer: DOCKER

azure-cli 2.26.0

Additional Context

Author: eseyden
Assignees: -
Labels:

Service Attention, Web Apps

Milestone: -

@yonzhan
Copy link
Collaborator

yonzhan commented Jul 12, 2021

route to service team

@Kotasudhakarreddy Kotasudhakarreddy changed the title az webapp config appsettings fails when using az-cli docker container alias WebApp:az webapp config appsettings fails when using az-cli docker container alias Jul 13, 2021
@Kotasudhakarreddy
Copy link
Contributor

looking in to it.

@Ramblurr
Copy link

Ramblurr commented Aug 12, 2021

I am having a similar error, except I am running az directly, not via a container. The error is occurring when I attempt to set the docker image name

az webapp config container set --name redacted --resource-group redacted --docker-custom-image-name "ghcr.io/redacted:redacted"

The command failed with an unexpected error. Here is the traceback:
'NoneType' object has no attribute 'lower'
Traceback (most recent call last):
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/util.py", line 506, in shell_safe_json_parse
    return json.loads(json_or_dict_string, strict=strict)
  File "/usr/lib64/python3.9/json/__init__.py", line 359, in loads
    return cls(**kw).decode(s)
  File "/usr/lib64/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/util.py", line 512, in shell_safe_json_parse
    return ast.literal_eval(json_or_dict_string)
  File "/usr/lib64/python3.9/ast.py", line 62, in literal_eval
    node_or_string = parse(node_or_string, mode='eval')
  File "/usr/lib64/python3.9/ast.py", line 50, in parse
    return compile(source, filename, mode, flags,
  File "<unknown>", line 1
    WEBSITES_ENABLE_APP_SERVICE_STORAGE=false
                                       ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/az/lib/python3.6/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 657, in execute
    raise ex
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 691, in _run_job
    result = cmd_copy(params)
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/command_modules/appservice/custom.py", line 1342, in update_container_settings
    _add_fx_version(cmd, resource_group_name, name, docker_custom_image_name, slot)
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/command_modules/appservice/custom.py", line 1080, in _add_fx_version
    return update_site_configs(cmd, resource_group_name, name,
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/command_modules/appservice/custom.py", line 1144, in update_site_configs
    update_app_settings(cmd, resource_group_name, name, ["WEBSITES_ENABLE_APP_SERVICE_STORAGE=false"])
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/command_modules/appservice/custom.py", line 260, in update_app_settings
    temp = shell_safe_json_parse(s)
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/util.py", line 525, in shell_safe_json_parse
    parent_proc = get_parent_proc_name().lower()
AttributeError: 'NoneType' object has no attribute 'lower'

info:

  • Fedora Linux 33
  • az --version
azure-cli                         2.27.0 *

core                              2.27.0 *
telemetry                          1.0.6

Python location '/usr/bin/python3'
Extensions directory '/var/home/ramblurr/.azure/cliextensions'

Python (Linux) 3.9.6 (default, Jul 16 2021, 00:00:00) 
[GCC 10.3.1 20210422 (Red Hat 10.3.1-1)]

@seligj95
Copy link
Contributor

Unable to repro. Closing for now. Please let us know if this is still an issue for you and we can reopen and investigate further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app-service-linux-containers Service Attention This issue is responsible by Azure service team. Web Apps az webapp
Projects
None yet
Development

No branches or pull requests

5 participants