Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to copy image to another resource group #1151

Closed
wants to merge 3 commits into from
Closed

Unable to copy image to another resource group #1151

wants to merge 3 commits into from

Conversation

imabedalghafer
Copy link
Contributor

@imabedalghafer imabedalghafer commented Dec 13, 2019

Command Name
az image copy Extension Name: image-copy-extension. Version: 0.2.2.

Errors:

Command '['/usr/bin/python', '-m', 'azure.cli', 'snapshot', 'create', '--name', 'optimizerredis-0.1.3_os_disk_snapshot', '--resource-group', 'sa-beta', '--source', u'https://factoryoptimizerred2235.blob.core.windows.net/vhds/optimizerredis-0.1.3.vhd', '--output', 'json', '--tags', 'created_by=image-copy-extension']' returned non-zero exit status 1 Traceback (most recent call last): python2.7/site-packages/knack/cli.py, ln 206, in invoke cmd_result = self.invocation.execute(args)

Suggested Solution:
Add a new variable to get the storage account id that is created and then pass it to create the snapshot. as in below example :

json_output = run_cli_command(cli_cmd, return_as_json=True)
target_blob_endpoint = json_output['primaryEndpoints']['blob']
target_sa_id = json_output['id']

and on the command to create the new snapshot:
cli_cmd = prepare_cli_command(['snapshot', 'create',
'--resource-group', snapshot_resource_group_name,
'--name', target_snapshot_name,
'--location', location,
'--source', target_blob_path,
'--source-storage-account-id', target_sa_id ],
subscription=target_subscription)

Tested locally and it is working as expected.

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

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?

For new extensions:

As the new Azure CLI create snapshot requires the storage account id to be a parameter based when creating the new snapshot
@azuresdkci
Copy link

If this PR is for a new extension or change to an existing extension, use the following to try out the changes in this PR:

docker run -it microsoft/azure-cli:latest
export EXT=<NAME>
pip install --upgrade --target ~/.azure/cliextensions/$EXT "git+https://github.com/imabedalghafer/azure-cli-extensions.git@master#subdirectory=src/$EXT&egg=$EXT"

@tamirkamara
Copy link
Contributor

@imabedalghafer, thank you for this contribution.
Can you please edit the title and description of this issue to explain?

I think we should wait for a proper response on the root issue before going to fix something that might result in other issues down the line.
Original issue on the extension is here: #1097

@imabedalghafer imabedalghafer changed the title To match the new change in Azure CLI Unable to copy image to another resource group Dec 23, 2019
@jsntcy jsntcy requested a review from qwordy January 14, 2020 02:07
@jsntcy
Copy link
Member

jsntcy commented Jan 14, 2020

@qwordy, please help review it, thanks.

1 similar comment
@jsntcy
Copy link
Member

jsntcy commented Jan 14, 2020

@qwordy, please help review it, thanks.

@qwordy
Copy link
Member

qwordy commented Jan 14, 2020

I check the code. There is already a fix in the code. You need to git fetch/pull the latest version

@yonzhan yonzhan added this to the S164 milestone Jan 14, 2020
@qwordy
Copy link
Member

qwordy commented Feb 4, 2020

We are very sorry that this PR will not be merged. This bug has been fixed by another PR before this PR. Thanks for your contribution. You can install latest version of image copy and try it.

@qwordy qwordy closed this Feb 4, 2020
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.

6 participants