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

image-copy: add support for setting target subscription #265

Merged
merged 20 commits into from
Aug 20, 2018
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
411c2ab
update descriptions and version
tamirkamara Apr 16, 2018
cca0f84
Add checks to verify that the source has a managed disk
tamirkamara Apr 16, 2018
6e02dfc
fix procedure to name the temp storage account
tamirkamara Apr 16, 2018
b8a0b23
support tags and final image name
tamirkamara Apr 30, 2018
ca4cad8
Merge branch 'master' of https://github.com/Azure/azure-cli-extensions
tamirkamara Apr 30, 2018
7217d74
fix lint issue
tamirkamara Apr 30, 2018
3659843
Merge branch 'master' into master
derekbekoe Apr 30, 2018
2f6cf94
remove debug statement
tamirkamara May 1, 2018
0530a79
add version 0.0.6 to index
tamirkamara May 1, 2018
b60ffe8
Merge branch 'master' of https://github.com/tamirkamara/azure-cli-ext…
tamirkamara May 1, 2018
abbe99a
Merge branch 'master' of https://github.com/Azure/azure-cli-extensions
tamirkamara May 1, 2018
6bca0d1
Merge branch 'master' of https://github.com/Azure/azure-cli-extensions
tamirkamara Jun 2, 2018
5aa931c
support sources backed by vhd blobs (copied images) and snapshots
tamirkamara Jun 11, 2018
6994857
fix how we find the source_os_disk_id
tamirkamara Jun 11, 2018
e02a95f
adding image-copy version 0.0.7 to the index
tamirkamara Jun 11, 2018
c8700e3
merge
tamirkamara Aug 18, 2018
8b27a87
image-copy: add support for setting target subscription
tamirkamara Aug 19, 2018
5b383fa
Merge branch 'master' of https://github.com/tamirkamara/azure-cli-ext…
tamirkamara Aug 19, 2018
9d731be
remove unused import
tamirkamara Aug 19, 2018
370ccf7
fix lint issue
tamirkamara Aug 19, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix how we find the source_os_disk_id
  • Loading branch information
tamirkamara committed Jun 11, 2018
commit 6994857684530f4f509236f12d4a3cb434265e01
32 changes: 19 additions & 13 deletions src/image-copy/azext_imagecopy/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,31 @@ def imagecopy(source_resource_group_name, source_object_name, target_location,
logger.warn(
"Data disks in the source detected, but are ignored by this extension!")

source_os_disk_id = None
source_os_disk_type = None

try:
source_os_disk_id = json_cmd_output['storageProfile']['osDisk']['managedDisk']['id']
if source_os_disk_id is None:
raise TypeError
source_os_disk_type = "DISK"
logger.debug("found %s: %s", source_os_disk_type, source_os_disk_id)
except TypeError:
pass

try:
source_os_disk_id = json_cmd_output['storageProfile']['osDisk']['blobUri']
source_os_disk_type = "BLOB"
except TypeError:
pass

try: # images created by e.g. image-copy extension
source_os_disk_id = json_cmd_output['storageProfile']['osDisk']['snapshot']['id']
source_os_disk_type = "SNAPSHOT"
except TypeError:
pass
try:
source_os_disk_id = json_cmd_output['storageProfile']['osDisk']['blobUri']
if source_os_disk_id is None:
raise TypeError
source_os_disk_type = "BLOB"
logger.debug("found %s: %s", source_os_disk_type, source_os_disk_id)
except TypeError:
try: # images created by e.g. image-copy extension
source_os_disk_id = json_cmd_output['storageProfile']['osDisk']['snapshot']['id']
if source_os_disk_id is None:
raise TypeError
source_os_disk_type = "SNAPSHOT"
logger.debug("found %s: %s", source_os_disk_type, source_os_disk_id)
except TypeError:
pass

if source_os_disk_type is None or source_os_disk_id is None:
logger.error(
Expand Down