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

UnboundLocalError in vmdk.py when disk image conversion errors #67

Closed
glennmatthews opened this issue Mar 22, 2017 · 0 comments
Closed
Assignees
Labels

Comments

@glennmatthews
Copy link
Owner

Traceback (most recent call last):
  File "cot", line 66, in <module>
    COT.ui.cli.main()
  File "COT/ui/cli.py", line 717, in main
    CLI().run(sys.argv[1:])
  File "COT/ui/cli.py", line 324, in run
    return self.main(args)
  File "COT/ui/cli.py", line 601, in main
    args.instance.run()
  File "COT/commands/add_disk.py", line 210, in run
    description=self.description)
  File "COT/commands/add_disk.py", line 581, in add_disk_worker
    disk_image = vm.convert_disk_if_needed(disk_image, drive_type)
  File "COT/vm_description/ovf/ovf.py", line 1893, in convert_disk_if_needed
    new_directory=self.working_dir)
  File "COT/disks/disk.py", line 193, in convert_to
    return subclass.from_other_image(self, new_directory, new_subformat)
  File "COT/disks/vmdk.py", line 112, in from_other_image
    os.remove(temp_image.path)
UnboundLocalError: local variable 'temp_image' referenced before assignment
                    try:
                        temp_image = RAW.from_other_image(input_image,
                                                          output_dir)
                        return cls.from_other_image(temp_image,
                                                    output_dir,
                                                    output_subformat)
                    finally:
                        os.remove(temp_image.path)

RAW.from_other_image raised an error (in this particular case, due to disk space exhaustion) and so temp_image was not yet set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant