Audapure/wo cli improvements#9861
Conversation
The `az workload-orchestration cluster init` command depends on three az CLI extensions at runtime (connectedk8s, k8s-extension, customlocation). If any are missing, sub-command invocations fail with opaque errors. This change adds a Step 0 in `target_prepare()` that ensures all three extensions are installed before preflight, mirroring the `azext_vme.utils.check_and_add_cli_extension` pattern. - common/utils.py: add REQUIRED_CLI_EXTENSIONS, check_and_add_cli_extension, ensure_required_cli_extensions. Uses subprocess (not invoke_cli_command) so freshly installed extensions are picked up correctly. - common/target.py: call ensure_required_cli_extensions() at the start of target_prepare; record step_results["cli-extensions"] = "Ready" on success and surface failures via _print_failure_hint. Tested end-to-end: removed all 3 extensions, ran the auto-install path, verified all 3 reinstalled successfully. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…: ..." log The "Adding N: name1, name2, ..." line was duplicating information the user just typed and could dump a huge comma-separated list to stdout for bulk capability-add operations. The subsequent "Done (N total capabilities)" line already conveys the result. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Validation for Breaking Change Starting...
Thanks for your contribution! |
|
Hi @atharvau, |
|
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 improves the workload-orchestration extension’s target prepare flow by proactively ensuring dependent Azure CLI extensions are installed before invoking subcommands that rely on them, reducing failures due to missing extensions. It also removes a noisy capability-add log line in context operations.
Changes:
- Add utilities to detect/install required Azure CLI extensions (
connectedk8s,k8s-extension,customlocation) via a subprocess-basedaz extension add. - Invoke the dependency check at the start of
target_prepareand surface status in the existing step-results failure hint flow. - Remove verbose “Adding …” logging from
capability_add.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/workload-orchestration/azext_workload_orchestration/common/utils.py |
Adds required-extension list and helper functions to check/install CLI dependencies. |
src/workload-orchestration/azext_workload_orchestration/common/target.py |
Calls the new dependency check as “Step 0” in target_prepare. |
src/workload-orchestration/azext_workload_orchestration/common/context.py |
Removes a capability-add status log line. |
| "-o", "tsv"], | ||
| capture_output=True, text=True, check=True, encoding="utf-8" | ||
| ) | ||
| if extension_name in (result.stdout or "").strip(): |
| def ensure_required_cli_extensions(extension_names=None): | ||
| """Ensure all required az CLI extensions are installed. | ||
|
|
||
| Defaults to REQUIRED_CLI_EXTENSIONS. Idempotent — skips already-installed | ||
| extensions. Fails fast with a clear message if any install fails. | ||
| """ | ||
| extensions = extension_names if extension_names is not None else REQUIRED_CLI_EXTENSIONS | ||
| for ext in extensions: | ||
| check_and_add_cli_extension(ext) |
…tall Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add ServiceGroup creation status line (created/reused) with checkmark in hierarchy create tree output, consistent with Site, Configuration, and ConfigurationReference lines. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Matches the same cleanup already applied to add-capability. The '✓ Done' message is sufficient feedback. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Both add-capability and remove-capability were printing noisy '✓ Done (N total capabilities)' messages to stderr. The JSON response already contains the updated resource — no need for extra status noise. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This checklist is used to make sure that common guidelines for a pull request are followed.
Related command
General Guidelines
azdev style <YOUR_EXT>locally? (pip install azdevrequired)python scripts/ci/test_index.py -qlocally? (pip install wheel==0.30.0required)For new extensions:
About Extension Publish
There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update
src/index.jsonautomatically.You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify
src/index.json.