diff --git a/image_creator/os_type/windows/__init__.py b/image_creator/os_type/windows/__init__.py index c228430eaecdcd777e8c278e3ab5622cf605de6e..c4b464bb72aad7e0a7c3922acb506dcbdc75aa42 100644 --- a/image_creator/os_type/windows/__init__.py +++ b/image_creator/os_type/windows/__init__.py @@ -391,13 +391,12 @@ class Windows(OSBase): if m: querymax = m.group(1) else: - FatalError( - "Unexpected output for `shrink querymax' command: %s" % - line) + raise FatalError("Unexpected output for `shrink querymax' " + "command: %s" % line) if querymax is None: - FatalError("Error in shrinking! " - "Couldn't find the max number of reclaimable bytes!") + raise FatalError("Error in shrinking! Couldn't find the max " + "number of reclaimable bytes!") querymax = int(querymax) # From ntfsresize: @@ -426,9 +425,9 @@ class Windows(OSBase): stdout, stderr, rc = self.vm.rexec(cmd, fatal=False) if rc != 0: - FatalError("Shrinking failed. Please make sure the media is " - "defraged with a command like this: " - "`Defrag.exe /U /X /W'") + raise FatalError("Shrinking failed. Please make sure the media is " + "defraged with a command like this: " + "`Defrag.exe /U /X /W'") for line in stdout.splitlines(): if line.find('shrunk') >= 0: self.out.output(" %s" % line) diff --git a/image_creator/os_type/windows/vm.py b/image_creator/os_type/windows/vm.py index 2ce262b89a512cad73d97d3b4b26f44fc3bf4aa6..b030d7ec2d81b88aeffa699fd3499ee0be6c9d56 100644 --- a/image_creator/os_type/windows/vm.py +++ b/image_creator/os_type/windows/vm.py @@ -46,7 +46,7 @@ class VM(object): kvm, needed_args = get_kvm_binary() if kvm is None: - FatalError("Can't find the kvm binary") + raise FatalError("Can't find the kvm binary") self.kvm = [kvm] + list(needed_args) @@ -235,7 +235,7 @@ class VM(object): try: (stdout, stderr, rc) = winexe.run(command) except WinexeTimeout: - FatalError("Command: `%s' timeout out." % command) + raise FatalError("Command: `%s' timeout out." % command) if rc != 0 and fatal: log = tempfile.NamedTemporaryFile(delete=False)