[App Config] az appconfig kv import/export/restore: Add dry-run feature#30842
[App Config] az appconfig kv import/export/restore: Add dry-run feature#30842zhoxing-ms merged 8 commits intoAzure:devfrom
az appconfig kv import/export/restore: Add dry-run feature#30842Conversation
|
Hi @ChristineWanjau, |
️✔️AzureCLI-FullTest
|
|
| rule | cmd_name | rule_message | suggest_message |
|---|---|---|---|
| appconfig kv export | cmd appconfig kv export added parameter dry_run |
||
| appconfig kv import | cmd appconfig kv import added parameter dry_run |
||
| appconfig kv restore | cmd appconfig kv restore added parameter dry_run |
|
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>
|
az appconfig kv import/export/restore: Add dry-run featureaz appconfig kv import/export/restore: Add dry-run feature
|
Please fix CI issues |
|
Please resolve these CI issues and add some test cases |
|
Please note that Azure CLI will have a code freeze on 03/25/2025 07:00 UTC for the upcoming release. If you want to catch this release train, please address the commands ASAP, otherwise it has to be postponed to next sprint (05-06) |
|
please note that Azure CLI will have a code freeze on 04/21/2025 07:00 UTC for the upcoming release. Please address the comments ASAP, otherwise it has to be postponed to next sprint (05-19). |
az appconfig kv import/export/restore: Add dry-run featureaz appconfig kv import/export/restore: Add dry-run feature
|
Any update? |
| return | ||
|
|
||
| # If yes is provided, it should take precedence over dry-run | ||
| if dry_run and not yes: |
There was a problem hiding this comment.
dry-run is supposed to be a safety net. Is there a reason --yes would take precedence over it?
There was a problem hiding this comment.
I think we should not allow dry-run and --yes to be specified together.
There was a problem hiding this comment.
I agree, dry-run should not lead to a point of user confirmation so --yes should not be applicable
There was a problem hiding this comment.
This makes sense to me. Added validation to not allow dry-run and yes to specified together
|
|
||
| need_change = __print_restore_preview(restore_diff, yes=yes) | ||
|
|
||
| if dry_run and not yes: |
There was a problem hiding this comment.
We can validate that dry-run and yes are not specified together and return if only dry-run is True
| c.argument('skip_features', help="Import only key values and exclude all feature flags. By default, all feature flags will be imported from file or appconfig. Not applicable for appservice.", arg_type=get_three_state_flag()) | ||
| c.argument('content_type', help='Content type of all imported items.') | ||
| c.argument('import_mode', arg_type=get_enum_type([ImportMode.ALL, ImportMode.IGNORE_MATCH]), help='If import mode is "ignore-match", only source key-values that do not already exist or whose value, content-type or tags are different from that of an existing key-value with the same key and label, will be written. Import mode "all" writes all key-values to the destination regardless of whether they exist or not.') | ||
| c.argument('dry_run', validator=validate_dry_run, help="Perform a dry-run to validate the import operation without making changes to the App Configurations store. Any updates that would normally occur will be printed to the console for review.") |
There was a problem hiding this comment.
| c.argument('dry_run', validator=validate_dry_run, help="Perform a dry-run to validate the import operation without making changes to the App Configurations store. Any updates that would normally occur will be printed to the console for review.") | |
| c.argument('dry_run', validator=validate_dry_run, help="Preview the result of import operation without making any changes to the App Configuration store.") |
| if not need_kv_change and not need_feature_change: | ||
| return | ||
|
|
||
| if dry_run: |
There was a problem hiding this comment.
dry-run is not honored when profile is kvset
There was a problem hiding this comment.
Added dry-run for kvset
| return | ||
|
|
||
| if not yes: | ||
| if need_change is False: |
There was a problem hiding this comment.
Shouldnt we check for need_change before checking for yes?
The debug message looks unnecessary. I think we can follow the same pattern as import/export here:
if not need_change:
return
if dry_run:
return
# if customer needs preview & confirmation
if not yes:
user_confirmation("Do you want to continue? \n")
There was a problem hiding this comment.
Actually, we can combine the checks for need_change and dry_run:
if not need_change or dry_run:
return
# if customer needs preview & confirmation
if not yes:
user_confirmation("Do you want to continue? \n")
There was a problem hiding this comment.
This makes sense. Updated
| if not need_kv_change and not need_feature_change: | ||
| return | ||
|
|
||
| if dry_run: | ||
| return |
There was a problem hiding this comment.
| if not need_kv_change and not need_feature_change: | |
| return | |
| if dry_run: | |
| return | |
| if (not need_kv_change and not need_feature_change) or (dry_run): | |
| return |
Related command
az appconfig kv import
az appconfig kv export
az appconfig kv restore
Description
This PR adds a new argument --dry-run to import/export/restore commands. This just previews the changes on the console without making actual changes to the appconfig store.
Feature request - Azure/AppConfiguration#1014
Testing Guide
History Notes
[App Config]
az appconfig kv import/export/restore: Add new parameter--dry-runto support dry-run featureThis 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.