From bb4db5a831cfe6e97de95a9873163d69372deb3e Mon Sep 17 00:00:00 2001 From: Nikos Skalkotos Date: Thu, 14 Jun 2012 11:37:20 +0300 Subject: [PATCH] Fix a bug introduced in 4e58b51b The error function main.py used for outputing errors has been removed and the code was not updated to use the error method of SimpleOutput output class. Also did a minor cleanup: git_os_class function was renamed to os_cls --- image_creator/main.py | 12 +++++------- image_creator/os_type/__init__.py | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/image_creator/main.py b/image_creator/main.py index 319fbf3..8857eb8 100644 --- a/image_creator/main.py +++ b/image_creator/main.py @@ -39,7 +39,7 @@ from image_creator.disk import Disk from image_creator.util import get_command, FatalError, MD5 from image_creator.output.cli import SilentOutput, SimpleOutput, \ OutputWthProgress -from image_creator.os_type import get_os_class +from image_creator.os_type import os_cls from image_creator.kamaki_wrapper import Kamaki import sys import os @@ -187,8 +187,8 @@ def image_creator(): dev = disk.get_device(snapshot) dev.mount() - osclass = get_os_class(dev.distro, dev.ostype) - image_os = osclass(dev.root, dev.g, out) + cls = os_cls(dev.distro, dev.ostype) + image_os = cls(dev.root, dev.g, out) out.output() for sysprep in options.disabled_syspreps: @@ -283,10 +283,8 @@ def main(): ret = image_creator() sys.exit(ret) except FatalError as e: - if sys.stdout.isatty(): - error(e) - else: - error(e, True, False) + colored = sys.stderr.isatty() + SimpleOutput(colored).error(e) sys.exit(1) diff --git a/image_creator/os_type/__init__.py b/image_creator/os_type/__init__.py index 98d570d..6fe1336 100644 --- a/image_creator/os_type/__init__.py +++ b/image_creator/os_type/__init__.py @@ -37,7 +37,7 @@ import textwrap import re -def get_os_class(distro, osfamily): +def os_cls(distro, osfamily): module = None classname = None try: -- 1.7.10.4