[appservice] Surface Kudu 409 response body in az webapp webjob triggered list#33825
az webapp webjob triggered list#33825Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
webapp |
az webapp webjob triggered list
Live test results —
|
There was a problem hiding this comment.
CI Failure Summary — PR #33825
The following checks failed on the latest commit (3a433def5ef1dd2e5b98505c6a29077d0c5c67b0):
- Azure.azure-cli (build) — failed
- Azure.azure-cli (Check CLI Style) — failed
Both failures stem from the same root cause, a pylint style violation:
ERROR: ************* Module azure.cli.command_modules.appservice.custom
src/azure-cli/azure/cli/command_modules/appservice/custom.py:10453:4: W0621: Redefining name 'json' from outer scope (line 20) (redefined-outer-name)
src/azure-cli/azure/cli/command_modules/appservice/custom.py:10453:4: W0404: Reimport 'json' (imported line 20) (reimported)
json is already imported at module scope (line 20 of src/azure-cli/azure/cli/command_modules/appservice/custom.py). The code added at line 10453 re-imports json locally inside a function, which is unnecessary and triggers both redefined-outer-name and reimported pylint errors.
Fix needed: remove the local/inner import json statement at line 10453 in src/azure-cli/azure/cli/command_modules/appservice/custom.py (the module-level import at the top of the file already covers it). After removing it, run azdev style appservice locally to confirm the style check passes, then push the fix.
Posted by agent-assist (autonomous bug-fix pipeline).
|
@copilot the automated CI and live-test review on this PR found failures. Please look into the requested changes here: #33825 (review) and push a fix. Posted by agent-assist (autonomous bug-fix pipeline). |
Fixed in the latest commit. The CI failures were caused by a redundant |
Live test results —
|
There was a problem hiding this comment.
✅ All checks passed
Live tests passed and all CI checks are green. This PR is ready for human review.
Posted by agent-assist (autonomous bug-fix pipeline).
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot could not run the full agentic suite for this review because it was automatically requested on a bot-authored pull request. Request a review from Copilot under Reviewers to retry with the full agentic suite. Improved support for bot-authored pull requests is coming soon.
This PR improves the UX of list_triggered_webjobs by surfacing Kudu-provided error details when the API responds with HTTP 409, and adds unit tests to validate the new behavior.
Changes:
- Catch
HttpResponseErrorforlist_triggered_webjobsand convert HTTP 409 intoUnclassifiedUserFaultwith a parsed message from the response body. - Add unit tests to ensure 409 is converted and non-409 errors are re-raised.
- Add basic fallback behavior when the response body is not JSON.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/azure-cli/azure/cli/command_modules/appservice/custom.py |
Adds HTTP 409 handling and response-body parsing for list_triggered_webjobs. |
src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_webapp_commands_thru_mock.py |
Adds tests validating error translation and fallback parsing behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| try: | ||
| response_text = ex.response.text() | ||
| except TypeError: | ||
| response_text = ex.response.text | ||
| try: | ||
| message = json.loads(response_text).get('error') or str(ex) | ||
| except (ValueError, AttributeError): | ||
| message = str(ex) |
| message = json.loads(response_text).get('error') or str(ex) | ||
| except (ValueError, AttributeError): | ||
| message = str(ex) | ||
| raise UnclassifiedUserFault(message) |
| error = HttpResponseError(message="Operation returned an invalid status '{}'".format(status_code)) | ||
| error.status_code = status_code | ||
| error.response = response_mock |
| response_text = ex.response.text() | ||
| except TypeError: | ||
| response_text = ex.response.text |
Related command
az webapp webjob triggered listDescription
When Kudu returns
409 Conflict(e.g.webJobsEnabled=falseon the site config), the Azure SDK raisesHttpResponseErrorwith only the HTTP status phrase, discarding the actionable response body:{"error": "The web app is not configured to run the web job. Please enable running web jobs before calling the API."}Previously the CLI emitted only
Operation returned an invalid status 'Conflict'.Fix:
list_triggered_webjobsnow catchesHttpResponseErrorwithstatus_code == 409, parses the Kudu JSON body, and raisesUnclassifiedUserFaultwith the extractederrorstringstr(ex)if the body is absent or not valid JSONTesting Guide
New unit tests in
test_webapp_commands_thru_mock.py::TestListTriggeredWebjobs:# Run the targeted mock tests python -m pytest src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_webapp_commands_thru_mock.py::TestListTriggeredWebjobs -vThree cases covered:
UnclassifiedUserFaultwith the extracted messageHttpResponseError→ re-raised as-isUnclassifiedUserFaultwith fallback stringHistory Notes
[appservice]
az webapp webjob triggered list: Surface Kudu error body on HTTP 409 Conflict instead of generic status phraseThis 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.