Skip to content

[Redis] Fix #33893: az redis import: Add confirmation prompt matching flush and delete - #33905

Open
Daz (8dazo) wants to merge 3 commits into
Azure:devfrom
8dazo:fix-33893-redis-import-confirmation
Open

[Redis] Fix #33893: az redis import: Add confirmation prompt matching flush and delete#33905
Daz (8dazo) wants to merge 3 commits into
Azure:devfrom
8dazo:fix-33893-redis-import-confirmation

Conversation

@8dazo

Copy link
Copy Markdown

Related command
az redis import
az redis import-method
az redis flush
az redis delete

Description
Fixes #33893.

az redis import replaces all cache data and makes the cache unavailable during the operation, but unlike az redis flush and az redis delete it ran with no confirmation prompt and no --yes.

This change uses the same confirmation=True pattern already used by flush and delete:

  • Interactive runs prompt before import
  • --yes / -y skips the prompt
  • Help text states that existing cache data is deleted and the cache is inaccessible during import
  • Hidden az redis import-method gets the same guard because it shares cli_redis_import

Non-interactive scripts that currently call az redis import without -y will need to pass -y, same as flush and delete.

Testing Guide
Local verification (no live cache):

  1. python3 -m py_compile on the three changed files — pass
  2. flake8 on commands.py and _help.py using repo .flake8 — pass
  3. Command table check: az redis delete, az redis flush, az redis import, and az redis import-method all register confirmation=True
  4. Help for import/import-method includes "Deletes all preexisting cache data"
  5. Scenario tests pass -y on import, matching flush/delete

After this ships, --help should match the issue repro:

az redis import --help | grep -- --yes
    --yes -y               : Do not prompt for confirmation.

Skip the prompt in scripts:

az redis import -n MyCache -g MyResourceGroup --files <blobUrl> -y

History Notes
[Redis] az redis import: Add confirmation prompt (--yes) matching az redis flush and az redis delete


This checklist is used to make sure that common guidelines for a pull request are followed.

Made with Cursor

…atching flush and delete

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI lite review requested due to automatic review settings August 17, 2026 07:32
@8dazo
Daz (8dazo) requested review from a team as code owners August 17, 2026 07:32
@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi Daz (@8dazo),
Since the current milestone time is less than 7 days, this pr may not catch up with this release.

@azure-pipelines

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

@microsoft-github-policy-service microsoft-github-policy-service Bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. Redis Cache Auto-Assign Auto assign by bot act-codegen-extensibility-squad labels Aug 17, 2026

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.

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 import and the deprecated az redis import-method commands.
  • Update scenario tests to pass -y for 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.

Comment on lines +61 to +62
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.
Comment on lines 196 to 197
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]
@8dazo

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Co-authored-by: Cursor <cursoragent@cursor.com>
@8dazo

Copy link
Copy Markdown
Author

Yong Zhang (@yonzhan) could you verify this when you have a chance?

az redis import / import-method now prompt with a destructive-data message (skip with --yes/-y), matching flush/delete. Copilot's review is addressed: custom confirmation wording, and the downtime note is in long-summary while short-summary still states that existing cache data is deleted.

@yonzhan

Copy link
Copy Markdown
Collaborator

Adding Qi Pan (@Pan-Qi) to help review this PR

@coopercox-ms Cooper Cox (coopercox-ms) added the azure-client-tools-agent Pull request commented on or reviewed by Azure Client Tools Agent label Aug 18, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

🔔 Routing this PR to @Azure/act-codegen-extensibility-squad.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

act-codegen-extensibility-squad Auto-Assign Auto assign by bot azure-client-tools-agent Pull request commented on or reviewed by Azure Client Tools Agent customer-reported Issues that are reported by GitHub users external to the Azure organization. Redis Cache

Projects

None yet

Development

Successfully merging this pull request may close these issues.

az redis import should carry a destructive-data warning and confirmation prompt (--yes), matching az redis flush and az redis delete

5 participants