Skip to content

Can't use az image copy #84

Closed
Closed

Description

@Wolf7horne

image-copy-extension

'NoneType' object is not subscriptable

Getting os disk id of the source vm/image
'NoneType' object is not subscriptable
Traceback (most recent call last):
File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 194, in invoke
cmd_result = self.invocation.execute(args)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 342, in execute
six.reraise(*sys.exc_info())
File "/opt/az/lib/python3.6/site-packages/six.py", line 693, in reraise
raise value
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 315, in execute
result = cmd(params)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 175, in call
return super(AzCliCommand, self).call(*args, **kwargs)
File "/opt/az/lib/python3.6/site-packages/knack/commands.py", line 109, in call
return self.handler(*args, **kwargs)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/init.py", line 349, in default_command_handler
result = op(**command_args)
File "/home/Wolfthorne/.azure/cliextensions/image-copy-extension/azext_imagecopy/custom.py", line 27, in imagecopy
source_os_disk_id = json_cmd_output['storageProfile']['osDisk']['managedDisk']['id']
TypeError: 'NoneType' object is not subscriptable

Activity

  1. derekbekoe commented on Feb 27, 2018

    @derekbekoe
    Member

    Wolf7horne Are you attempting to use this against Public Azure?

  2. Wolf7horne commented on Feb 28, 2018

    @Wolf7horne
    Author
  3. tamirkamara commented on Feb 28, 2018

    @tamirkamara
    Contributor

    Wolf7horne:

    1. Can you share your full command?
    2. Is it a managed image (an image created from a managed vm/disk)?
    3. Does the source disk still exists in your subscription?
  4. Wolf7horne commented on Feb 28, 2018

    @Wolf7horne
    Author

    Tamir Kamara (@tamirkamara)

    1. az image copy --source-resource-group WestUS --source-object-name Goldv9Image --target-resource-group EastUS --targe-location eastus2 --cleanup
    2. osDisk and dataDisk both have managedDisk = null, another thing to note is that it is already generalized as well.
    3. Yes it does
  5. tamirkamara commented on Mar 5, 2018

    @tamirkamara
    Contributor

    Wolf7horne
    I think this means that the vm isn't based on managed disks. Can you rerun the command with --debug and send the full output?

  6. PoisonousJohn commented on Apr 2, 2018

    @PoisonousJohn

    Tamir Kamara (@tamirkamara) the same issue, full output attached.

    Full command az image copy --source-resource-group batch_template_vms --source-object-name template-batch-vm-image-54509 --target-location northeurope --target-resource-group batch_experiments --cleanup --debug 2> log.txt

    log.txt

  7. tamirkamara commented on Apr 2, 2018

    @tamirkamara
    Contributor

    Ivan Fateev (@PoisonousJohn)
    This extension is using the managed disk of the source vm from which the image was created.
    In the output it looks like the disk source is in a blob. What was the process to create your image? Was the vm managed-disk based?

    Tamir

  8. PoisonousJohn commented on Apr 2, 2018

    @PoisonousJohn

    Tamir Kamara (@tamirkamara) as it was mentioned by Wolf7horne, the case is related to blob-based image (non-managed disk).

    I understand that for now this extension assumes you're using image disk. Do you have any plans on supporting blob images?

  9. added a commit that references this issue on Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions