Repository navigation
[monitor-control-service] Fix invalid escape sequence SyntaxWarning in data-collection rule create example - #10532
nabeleon94 wants to merge 1 commit into
Conversation
…n data-collection rule create example
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Thank you for your contribution nabeleon94! We will review the pull request and get back to you soon. |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the change addressing the Python 3.12+ invalid-escape warning.
No open issues 🎉
What changed in this PR
Fixes the invalid-escape SyntaxWarning emitted when the monitor-control-service extension loads for az monitor commands on Python 3.12+, addressing #10531 without changing rendered help text.
Changes:
- Escapes backslashes in the data collection rule creation example.
- Bumps the extension version to 1.2.1 and documents the fix.
| File | Description |
|---|---|
src/monitor-control-service/setup.py |
Bumps the extension version to 1.2.1. |
src/monitor-control-service/HISTORY.rst |
Adds a release note describing the warning fix. |
src/monitor-control-service/azext_amcs/aaz/latest/monitor/data_collection/rule/_create.py |
Escapes the example path’s backslashes while preserving help output. |
Review effort: Balanced
|
@microsoft-github-policy-service agree |
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
|
Thanks for the review and the
Re-recording the amcs cassettes needs a live subscription, so I've left them alone. I'm happy to adjust anything if you'd like. |
🤖 PR Validation — ❌ Action needed
❌Azure CLI Extensions Breaking Change Test
Fixes #10531
Related command
az monitor data-collection rule create(and everyaz monitor ...command, since the extension module is imported while building the command table)Description
With Python 3.12+ (e.g. Azure CLI 2.91.0), any
az monitorhelp/command prints:The class docstring for
monitor data-collection rule createcontains the example path"C:\samples\dcrEx1.json"in a regular (non-raw) string, so\sis an invalid escape. This escapes the backslashes (C:\\samples\\dcrEx1.json), the same way the sibling_update.pyalready writes\\Process(_Total)\\Thread Count. The rendered help text is unchanged.Also bumps the extension to 1.2.1 with a HISTORY entry.
This is the only invalid escape sequence in the extension (checked by compiling every
.pyundersrc/monitor-control-servicewith warnings as errors).Testing
python -W error::SyntaxWarning -c "import azext_amcs.aaz.latest.monitor.data_collection.rule._create"fails withSyntaxError: invalid escape sequence '\s'.Create.__doc__(the help text) is byte-identical to before. It still shows--rule-file "C:\samples\dcrEx1.json".General Guidelines
azdev style <YOUR_EXT>locally? The changed file is# pylint: skip-file/# flake8: noqagenerated code. Only a string literal changed.python scripts/ci/test_index.py -qlocally? Not applicable:src/index.jsonis not modified.