[App Service] az webapp config appsettings set: Fix SyntaxWarning invalid decimal literal#32136
[App Service] az webapp config appsettings set: Fix SyntaxWarning invalid decimal literal#32136
az webapp config appsettings set: Fix SyntaxWarning invalid decimal literal#32136Conversation
Fixes Azure#32084 When using 'az webapp config appsettings set' with values like 'TestKey=6in', users were seeing SyntaxWarning: invalid decimal literal. This was happening because the code was trying to parse simple key=value pairs through ast.literal_eval(), which interprets '6in' as an invalid numeric literal. The fix adds a fast-path for simple key=value pairs that avoids calling shell_safe_json_parse (and thus ast.literal_eval) when the input clearly looks like a simple assignment rather than JSON or Python dict syntax. Changes: - Added detection for simple key=value patterns - Parse them directly with split() to avoid ast.literal_eval warnings - Preserve existing functionality for JSON and file input (@file) - Fall back to original parsing logic for complex cases Tested with values like 'TestKey=6in', 'AnotherKey=7in' that previously caused warnings. The fix eliminates the warnings while maintaining full compatibility with existing JSON and file-based input methods.
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a SyntaxWarning issue in the az webapp config appsettings set command that was causing false-positive error messages when setting simple key=value pairs. The fix adds early detection for basic key=value syntax to avoid unnecessary JSON parsing that triggered warnings.
- Adds pre-validation logic to handle simple key=value pairs without invoking JSON parsing
- Updates help text for container webhook URL command to clarify Basic Auth requirement
Reviewed Changes
Copilot reviewed 2 out of 6 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/appservice/custom.py | Adds early parsing for simple key=value pairs to avoid SyntaxWarning from JSON parser |
| src/azure-cli/azure/cli/command_modules/appservice/_help.py | Updates help text to clarify Basic Auth requirement for webhook URL |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
az webapp config appsettings set: Fix SyntaxWarning: invalid decimal literalaz webapp config appsettings set: Fix SyntaxWarning invalid decimal literal
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
Related command
az webapp config appsettings set
az webapp deployment container show-cd-url
Description
Validation was causing false-positive error message to be displayed in command output. Updated logic to only validate when needed.
Also updated help text for an unrelated command.
Fixes: #32097
Fixes: #32084
Testing Guide
az webapp config appsettings set -n -g --settings TestKey=6in --> should not display SyntaxWarning anymore
az webapp deployment container show-cd-url -n -g --> help text updated to make it clear that Basic Auth needs to be enabled in order to view the un-redacted URL
History Notes
[Component Name 1] BREAKING CHANGE:
az command a: Make some customer-facing breaking change[Component Name 2]
az command b: Add some customer-facing featureThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.