[Redis] Fix #33893: az redis import: Add confirmation prompt matching flush and delete - #33905
[Redis] Fix #33893: az redis import: Add confirmation prompt matching flush and delete#33905Daz (8dazo) wants to merge 3 commits into
az redis import: Add confirmation prompt matching flush and delete#33905Conversation
…atching flush and delete Co-authored-by: Cursor <cursoragent@cursor.com>
|
Hi Daz (@8dazo), |
|
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 was unable to run its full agentic suite in this review.
This PR adds confirmation prompts for destructive Redis import operations and updates tests/help content to support non-interactive execution.
Changes:
- Require confirmation for
az redis importand the deprecatedaz redis import-methodcommands. - Update scenario tests to pass
-yfor import operations. - Expand help text to warn that import deletes existing cache data and updates examples accordingly.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/redis/tests/latest/test_redis_scenario.py | Updates tests to include -y so confirmation prompts don’t block CI/live runs. |
| src/azure-cli/azure/cli/command_modules/redis/commands.py | Enables confirmation behavior for import commands at the command table level. |
| src/azure-cli/azure/cli/command_modules/redis/_help.py | Updates help summaries/examples to reflect destructive import behavior and new -y usage. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| g.custom_command('import-method', 'cli_redis_import', confirmation=True, deprecate_info=g.deprecate(redirect='redis import', hide=True)) | ||
| g.custom_command('import', 'cli_redis_import', confirmation=True) |
| helps['redis import'] = """ | ||
| type: command | ||
| short-summary: Import data into a Redis cache. | ||
| short-summary: Import data into a Redis cache. Deletes all preexisting cache data, and the cache is inaccessible to clients during the import. |
| short-summary: Import data into Redis cache. Deletes all preexisting cache data, and the cache is inaccessible to clients during the import. | ||
| long-summary: Usage example - az redis import-method --name testCacheName --resource-group testResourceGroup --files [--file-format] |
|
@microsoft-github-policy-service agree |
Co-authored-by: Cursor <cursoragent@cursor.com>
|
Yong Zhang (@yonzhan) could you verify this when you have a chance?
|
|
Adding Qi Pan (@Pan-Qi) to help review this PR |
Co-authored-by: Cursor <cursoragent@cursor.com>
Qi Pan (Pan-Qi)
left a comment
There was a problem hiding this comment.
Please re-record tests
|
Daz (@8dazo) can you please re-record tests for your changes. Thanks! |
|
Cooper Cox (@coopercox-ms) The -y flags are on az redis import / import-method so the tests match the new confirmation prompt. Those commands are still commented out in test_redis_cache_export_import, so they are not in the recordings and a re-record would not capture -y. I don’t have an Azure subscription to run live Redis tests. Please re-record on your side if you still want that, or I can uncomment the SAS import path if you prefer. |
|
Thanks Daz (@8dazo), you’re correct. I confirmed the SAS import commands are inside a disabled triple-quoted block, and the managed-identity import remains commented, so re-recording the current scenario would not exercise or capture -y . Since -y is CLI-side, it would not change the HTTP cassette either. Please don’t uncomment the SAS import flow solely for this change. Qi Pan (@Pan-Qi), could you clarify whether you would prefer the no-op test edits to be reverted and replaced with a focused non-live confirmation/help test? There is also a release-policy question: adding confirmation to an existing command means existing non-interactive scripts must add -y , which appears to meet Azure CLI’s definition of a breaking behavior change. |
There was a problem hiding this comment.
Automated review — PR #33905
CI: 8/9 checks passed. azdev-style has been queued for 6+ hours (stale) and could not be automatically re-triggered this round; not treated as a failure since nothing has actually failed.
Live test (azdev test --live --series): ❌ 1 failed, 1 passed (52m28s run). The failure is:
azure.cli.core.azclierror.AuthenticationError: AADSTS700024: Client assertion is not within
its valid time range. Current time: 2026-08-19T05:55:00Z, assertion valid from 04:58:58Z,
expiry time of assertion 05:03:58Z.
in test_redis_cache_authentication (command_modules/redis/tests/latest/test_redis_scenario.py).
This looks like a test-infrastructure flake, not a defect in the PR: the federated OIDC
token used for live testing expired mid-run because this test suite took ~52 minutes, far
longer than the ~5 minute token validity window. It is unrelated to the PR's actual change
(adding a confirmation prompt for az redis import).
Given @Pan-Qi already requested "Please re-record tests" on this PR, please re-run/re-record
once ready — the failure above should not block on the automation and looks like an
environment issue rather than a code issue.
|
🔔 Routing this PR to @Azure/act-codegen-extensibility-squad. |
Related command
az redis import
az redis import-method
az redis flush
az redis delete
Description
Fixes #33893.
az redis importreplaces all cache data and makes the cache unavailable during the operation, but unlikeaz redis flushandaz redis deleteit ran with no confirmation prompt and no--yes.This change uses the same
confirmation=Truepattern already used by flush and delete:--yes/-yskips the promptaz redis import-methodgets the same guard because it sharescli_redis_importNon-interactive scripts that currently call
az redis importwithout-ywill need to pass-y, same as flush and delete.Testing Guide
Local verification (no live cache):
python3 -m py_compileon the three changed files — passflake8oncommands.pyand_help.pyusing repo.flake8— passaz redis delete,az redis flush,az redis import, andaz redis import-methodall registerconfirmation=True-yon import, matching flush/deleteAfter this ships,
--helpshould match the issue repro:Skip the prompt in scripts:
History Notes
[Redis]
az redis import: Add confirmation prompt (--yes) matchingaz redis flushandaz redis deleteThis 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.
Made with Cursor