Skip to content

Comments

User/saif/new commands#9492

Closed
saifaldin14 wants to merge 56 commits intoAzure:mainfrom
saifaldin14:user/saif/newCommands
Closed

User/saif/new commands#9492
saifaldin14 wants to merge 56 commits intoAzure:mainfrom
saifaldin14:user/saif/newCommands

Conversation

@saifaldin14
Copy link
Contributor


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

Related command

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally? (pip install wheel==0.30.0 required)
  • My extension version conforms to the Extension version schema

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.json automatically.
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.

Copilot AI review requested due to automatic review settings December 22, 2025 18:51
@azure-client-tools-bot-prd
Copy link

Validation for Breaking Change Starting...

Thanks for your contribution!

@yonzhan
Copy link
Collaborator

yonzhan commented Dec 22, 2025

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link

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).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

@saifaldin14 saifaldin14 deleted the user/saif/newCommands branch December 22, 2025 18:53
@saifaldin14 saifaldin14 restored the user/saif/newCommands branch December 22, 2025 18:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the Azure Migrate CLI extension codebase to improve maintainability and adds new replication management commands. The changes reorganize helper functions into a modular structure and introduce commands for listing replications, removing replications, and retrieving job status.

Key Changes:

  • Restructured helper modules from flat files into organized subdirectories (helpers/replication/, helpers/)
  • Added three new commands: list, remove, and get-job for replication management
  • Updated parameter names from resource_group_name to resource_group for consistency
  • Version bump from 2.0.1b1 to 3.0.0b1

Reviewed changes

Copilot reviewed 26 out of 27 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
setup.py Version update to 3.0.0b1
linter_exclusions.yml Added test coverage exclusions for new commands
test_migrate_commands.py Updated import paths and parameter names in tests
custom.py Refactored imports, added new command implementations
commands.py Added new command registrations
_params.py Updated parameter definitions for consistency
_help.py Added help documentation for new commands
_get_discovered_server_helpers.py Added machine_id to server info output
HISTORY.rst Updated release history
helpers/replication/* New modular helper files for replication operations

Comment on lines +252 to +254
resource_group_name = machine_id_parts[4]
else:
raise CLIError(f"Invalid machine ARM ID format: '{machine_id}'")
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

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

The function returns rg_uri on line 258, but rg_uri is only assigned in the if machine_index: branch (line 122-124). When machine_id is provided directly (the else path starting at line 205), rg_uri is never set before being returned, which will cause an UnboundLocalError.

Copilot uses AI. Check for mistakes.
machine_id,
IdFormats.MachineArmIdTemplate):
raise CLIError(
f"Invalid -machine_id '{machine_id}'. "
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

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

The error message uses -machine_id with a hyphen prefix, but the actual parameter name in the code is machine_id without a leading hyphen. For consistency with CLI parameter naming conventions, this should be --machine-id or just machine_id.

Copilot uses AI. Check for mistakes.
Comment on lines +277 to +285
recoveryPoint = (
ReplicationPolicyDetails.RecoveryPointHistoryInMinutes.value
)
crashConsistentFreq = (
ReplicationPolicyDetails.CrashConsistentFrequencyInMinutes.value
)
appConsistentFreq = (
ReplicationPolicyDetails.AppConsistentFrequencyInMinutes.value
)
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

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

Variable names recoveryPoint, crashConsistentFreq, and appConsistentFreq use camelCase, which is inconsistent with Python's PEP 8 naming convention for variables. These should use snake_case: recovery_point, crash_consistent_freq, and app_consistent_freq.

Copilot uses AI. Check for mistakes.
Comment on lines +450 to +452
protected_item_uri,
APIVersion.Microsoft_DataReplication.value,
protected_item_body)
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

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

The protected_item_uri is missing a leading / character. Line 252 constructs it as subscriptions/{subscription_id}/... but ARM resource IDs should start with /subscriptions/.... This will cause API requests to fail.

Copilot uses AI. Check for mistakes.
Comment on lines +29 to +32
print(" az migrate local replication get-job "
"--job-name {} "
"--resource-group {} "
"--project-name <project-name>".format(job_name, resource_group_name))
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

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

The print statement uses hardcoded <project-name> placeholder while other values are formatted. Consider passing the actual project name if available, or use a consistent placeholder format for all parameters (e.g., <resource-group>, <job-name>).

Copilot uses AI. Check for mistakes.
Comment on lines +216 to +218
current_tool = amh_solution.get('properties', {}).get('tool')

needs_update = False
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

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

The variable current_tool is retrieved but not displayed in the logging statement if it needs update. The log on line 224 shows the target value but not the current value, making it harder to debug tool name mismatches.

Copilot uses AI. Check for mistakes.
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.

2 participants