[MCC] Fix validation errors that pointed users at a nonexistent argument - #10292
Conversation
Proxy validation errors on `az mcc ent node update` instructed the user to set --enable-proxy. That argument is deliberately unregistered, so following the guidance in the message failed with "unrecognized arguments". All eight messages now name --proxy, the argument the command actually exposes. The internal argument name is unchanged. az mcc ent node create reported the cache node name when it failed to find the MCC resource, even though the lookup uses the MCC resource name. A bare except also discarded the underlying error, so a mistyped resource group surfaced as a missing MCC resource. The message now names the MCC resource and the resource group, and includes the reason the lookup failed. Both bare except clauses are now except Exception with exception chaining. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 50dadd04-01f2-4767-883b-69a9a6f8a20d
|
Hi Denali Cornwell (@dcwell), |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟢 Approval recommended
The changes are low-risk and align with the PR’s stated goal; remaining feedback is limited to minor user-facing grammar/readability nits in the updated messages.
Pull request overview
Fixes user-facing validation and error messages in the mcc extension so they no longer direct users to nonexistent CLI arguments and so underlying lookup failures are preserved for troubleshooting.
Changes:
- Update proxy-related validation errors to reference
--proxy(instead of the unregistered/internal--enable-proxy). - Improve
az mcc ent node createMCC resource lookup failure reporting by including MCC resource name, resource group, and the underlying exception (via exception chaining). - Record these fixes in
HISTORY.rstunder the existing1.0.0b4entry.
File summaries
| File | Description |
|---|---|
src/mcc/azext_mcc/custom.py |
Updates validation/lookup error messages and replaces bare except: with except Exception as ex plus exception chaining. |
src/mcc/HISTORY.rst |
Documents the corrected error messages and preserved underlying exception behavior. |
Review details
Suppressed comments (2)
src/mcc/azext_mcc/custom.py:441
- Grammar: "Parameter --proxy is set not provided" is ungrammatical and reads like a typo; it should say that --proxy is not provided.
if has_value(args.proxy_host) or has_value(args.proxy_port):
err_msg = "ValidationError: Parameter --proxy is set not provided and cache node is in proxy state \"Disabled\": --proxy-host and --proxy-port cannot be provided."
raise ValidationError(err_msg)
src/mcc/azext_mcc/custom.py:446
- Grammar: the error message says "must provide --proxy-host and --proxy-port parameter" but it requires two parameters; this should be plural to avoid confusion.
if args.proxy == "Enabled":
if not has_value(args.proxy_host) or not has_value(args.proxy_port):
err_msg = "ValidationError: Parameter --proxy is set to \"Enabled\", must provide --proxy-host and --proxy-port parameter."
raise ValidationError(err_msg)
- Files reviewed: 2/2 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| except Exception as ex: | ||
| err_msg = "Cache node resource creation failed. CLI could not find the MCC resource \'" + str(args.mcc_resource_name) + "\' in resource group \'" + str(args.resource_group) + "\' that the cache node would be created on. " + str(ex) | ||
| raise CLIError(err_msg) from ex |
| if not has_value(args.proxy_host) or not has_value(args.proxy_port): | ||
| err_msg = "ValidationError: Parameter --enable-proxy is set to \"Enabled\", must provide --proxy-host and --proxy-port parameter." | ||
| err_msg = "ValidationError: Parameter --proxy is set to \"Enabled\", must provide --proxy-host and --proxy-port parameter." | ||
| raise ValidationError(err_msg) |
| if has_value(args.proxy_host) or has_value(args.proxy_port): | ||
| err_msg = "ValidationError: Parameter --enable-proxy is set not provided and cache node is in proxy state \"Disabled\": --proxy-host and --proxy-port cannot be provided." | ||
| err_msg = "ValidationError: Parameter --proxy is set not provided and cache node is in proxy state \"Disabled\": --proxy-host and --proxy-port cannot be provided." | ||
| raise ValidationError(err_msg) |
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
|
MCC |
1.0.0b4 was published to src/index.json after Azure#10290 merged, so the two error message fixes cannot ship under that version. Bump to 1.0.0b5 and move the entries into their own HISTORY block. Also address the two grammar issues raised in review, both on messages this branch already rewrites: - "Parameter --proxy is set not provided" was ungrammatical; it now reads "Parameter --proxy is not provided". - "must provide --proxy-host and --proxy-port parameter" referred to two parameters in the singular; it now reads "must provide both --proxy-host and --proxy-port parameters". Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 50dadd04-01f2-4767-883b-69a9a6f8a20d
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
|
[Release] Update index.json for extension [ mcc-1.0.0b5 ] : https://dev.azure.com/msazure/One/_build/results?buildId=179975905&view=results |
🤖 PR Validation — ️✔️ All clear
Related command
az mcc ent node update,az mcc ent node createDescription
Follow-up to #10290. Two user-facing error messages in the
mccextension pointed at the wrong thing. Both were found by an edge-case sweep of every validation path in the extension, run after #10290 merged.1. Proxy errors named an argument that does not exist
Eight proxy validation messages on
az mcc ent node updatetold the user to set--enable-proxy:enable_proxyis deliberately unregistered (args_schema.enable_proxy._registered = False); the argument the command exposes is--proxy. Following the guidance in the message produced:so the message led to a dead end. All eight now name
--proxy. The internal argument name is unchanged.2. Create reported the cache node when it could not find the MCC resource
MccEntNodeCreate.pre_operationslooks up the MCC resource to fill inlocation, but the failure message reportedargs.cache_node_name. A bareexcept:also discarded the underlying error, so a mistyped resource group surfaced as a missing MCC resource.Before:
After:
Both bare
except:clauses are nowexcept Exception as exwithraise ... from ex.Notes
1.0.0b4has not been published toindex.jsonyet, so these entries fold into the existing1.0.0b4block rather than adding a version.Testing
azdev linter --include-whl-extensions mcc— PASSEDazdev style mcc— pylint and flake8 PASSEDazdev test mcc— 1 passed