vmbuilder script fails on deploy/cleanup

Bug #795358 reported by Richard C
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
VMBuilder
New
Undecided
Unassigned
vm-builder (Ubuntu)
Triaged
Medium
Unassigned

Bug Description

Binary package hint: python-vm-builder

Originally attached to bug #562189

I believe this is a bug. There are two checks
for pre-existing VMs, and they differ:
/usr/lib/python2.7/dist-packages/VMBuilder/plugins/libvirt/__init__.py
line 54: if hostname in self.all_domains() and not
self.context.overwrite:
line 80: if hostname in self.all_domains() and not self.vm.overwrite:

Changing line 80 to match line 54 prevents this error. I believe this is an ok fix. Consider splitting this into a function, rather than copying and pasting code, if these are supposed to be identical lines.

Line 80 throws an error when run:
Traceback (most recent call last):
  File "/usr/bin/vmbuilder", line 24, in <module>
    cli.main()
  File "/usr/lib/python2.7/dist-packages/VMBuilder/contrib/cli.py", line 227,
in main
    hypervisor.finalise(destdir)
  File "/usr/lib/python2.7/dist-packages/VMBuilder/hypervisor.py", line 78, in
finalise
    self.call_hooks('deploy', destdir)
  File "/usr/lib/python2.7/dist-packages/VMBuilder/distro.py", line 67, in
call_hooks
    call_hooks(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/VMBuilder/util.py", line 158, in
call_hooks
    getattr(plugin, func, log_no_such_method)(*args, **kwargs)
  File
"/usr/lib/python2.7/dist-packages/VMBuilder/plugins/libvirt/__init__.py", line
80, in deploy
    if hostname in self.all_domains() and not self.vm.overwrite:
AttributeError: 'Libvirt' object has no attribute 'vm'

Related branches

Revision history for this message
Richard C (richard-c) wrote :
Revision history for this message
Richard C (richard-c) wrote :
Revision history for this message
Scott Moser (smoser) wrote :

Simply looking reading the bug description and looking at code, the solution seems sane. It appears like the change to Libvirt:deploy should have been made at the same time the change to 'preflight_check' was [1].

--
[1] http://bazaar.launchpad.net/~vmbuilder-dev/vmbuilder/0.12/revision/451

Changed in vm-builder (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.