Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'development' of github.com:rep/cuckoo into development

  • Loading branch information...
commit 1cc739617ee811ef647c6a00a5d46929b2b7a746 2 parents 3d76dd6 + dd154e3
rep authored
Showing with 22 additions and 22 deletions.
  1. +22 −22 modules/machinemanagers/virtualbox.py
View
44 modules/machinemanagers/virtualbox.py
@@ -79,28 +79,28 @@ def stop(self, label):
log.debug("Stopping vm %s" % label)
if self._status(label) in [self.POWEROFF, self.ABORTED]:
- log.debug("Trying to stop an already stopped vm %s" % label)
- else:
- try:
- proc = subprocess.Popen([self.options.virtualbox.path, "controlvm", label, "poweroff"],
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
- # Sometimes VBoxManage stucks when stopping vm so we needed
- # to add a timeout and kill it after that.
- stop_me = 0
- while proc.poll() is None:
- if stop_me < self.options.virtualbox.timeout:
- time.sleep(1)
- stop_me += 1
- else:
- log.debug("Stopping vm %s timeouted. Killing" % label)
- proc.terminate()
-
- if proc.returncode != 0 and stop_me < self.options.virtualbox.timeout:
- log.debug("VBoxManage exited with error powering off the machine")
- except OSError as e:
- raise CuckooMachineError("VBoxManage failed powering off the machine: %s" % e)
- self._wait_status(label, [self.POWEROFF, self.ABORTED])
+ raise CuckooMachineError("Trying to stop an already stopped vm %s" % label)
+
+ try:
+ proc = subprocess.Popen([self.options.virtualbox.path, "controlvm", label, "poweroff"],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ # Sometimes VBoxManage stucks when stopping vm so we needed
+ # to add a timeout and kill it after that.
+ stop_me = 0
+ while proc.poll() is None:
+ if stop_me < self.options.virtualbox.timeout:
+ time.sleep(1)
+ stop_me += 1
+ else:
+ log.debug("Stopping vm %s timeouted. Killing" % label)
+ proc.terminate()
+
+ if proc.returncode != 0 and stop_me < self.options.virtualbox.timeout:
+ log.debug("VBoxManage exited with error powering off the machine")
+ except OSError as e:
+ raise CuckooMachineError("VBoxManage failed powering off the machine: %s" % e)
+ self._wait_status(label, [self.POWEROFF, self.ABORTED])
def _list(self):
"""Lists virtual machines installed.
Please sign in to comment.
Something went wrong with that request. Please try again.