Skip to content

[MCC] Fix validation errors that pointed users at a nonexistent argument - #10292

Merged
Ethan Yang (necusjz) merged 3 commits into
Azure:mainfrom
dcwell:fix-mcc-validation-error-messages
Sep 7, 2026
Merged

[MCC] Fix validation errors that pointed users at a nonexistent argument#10292
Ethan Yang (necusjz) merged 3 commits into
Azure:mainfrom
dcwell:fix-mcc-validation-error-messages

Conversation

@dcwell

@dcwell Denali Cornwell (dcwell) commented Sep 3, 2026

Copy link
Copy Markdown
Member

🤖 PR Validation — ️✔️ All clear

Breaking Changes
️✔️ None

Related command

az mcc ent node update, az mcc ent node create

Description

Follow-up to #10290. Two user-facing error messages in the mcc extension 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 update told the user to set --enable-proxy:

ValidationError: Parameter --enable-proxy is set to "Enabled", must provide --proxy-host and --proxy-port parameter.

enable_proxy is deliberately unregistered (args_schema.enable_proxy._registered = False); the argument the command exposes is --proxy. Following the guidance in the message produced:

ERROR: unrecognized arguments: --enable-proxy Enabled

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_operations looks up the MCC resource to fill in location, but the failure message reported args.cache_node_name. A bare except: also discarded the underlying error, so a mistyped resource group surfaced as a missing MCC resource.

Before:

ERROR: Cache node resource creation failed. CLI could not find the specified MCC resource with name 'MyCacheNode' that the cache node would be created on.

After:

ERROR: Cache node resource creation failed. CLI could not find the MCC resource 'MyMccResource' in resource group 'MyResourceGroup' that the cache node would be created on. (ResourceGroupNotFound) Resource group 'MyResourceGroup' could not be found.

Both bare except: clauses are now except Exception as ex with raise ... from ex.

Notes

  • No behaviour change to validation itself — only the text of the errors and the preservation of the underlying exception.
  • 1.0.0b4 has not been published to index.json yet, so these entries fold into the existing 1.0.0b4 block rather than adding a version.

Testing

  • azdev linter --include-whl-extensions mcc — PASSED
  • azdev style mcc — pylint and flake8 PASSED
  • azdev test mcc — 1 passed
  • 105-command sweep (69 offline, 28 live against real Azure resources, 8 raw REST comparisons) re-run after the change.

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
Copilot AI lite review requested due to automatic review settings September 3, 2026 04:20
@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi Denali Cornwell (@dcwell),
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in pyproject.toml (or setup.py, if the extension has not migrated yet) as well.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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 create MCC resource lookup failure reporting by including MCC resource name, resource group, and the underlying exception (via exception chaining).
  • Record these fixes in HISTORY.rst under the existing 1.0.0b4 entry.
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.

Comment on lines +220 to +222
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
Comment on lines 425 to 427
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)
Comment on lines 435 to 437
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)
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).

@yonzhan

Copy link
Copy Markdown
Collaborator

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
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).

@necusjz
Ethan Yang (necusjz) merged commit 8df27ad into Azure:main Sep 7, 2026
24 checks passed
@azclibot

Copy link
Copy Markdown
Collaborator

[Release] Update index.json for extension [ mcc-1.0.0b5 ] : https://dev.azure.com/msazure/One/_build/results?buildId=179975905&view=results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants