From: Michael Goldish Subject: [KVM-AUTOTEST PATCH 07/18] KVM test: kvm_preprocessing.py: simplify pre/post_command error handling Date: Fri, 18 Jun 2010 03:14:24 +0300 Message-ID: <1276820075-31310-7-git-send-email-mgoldish@redhat.com> References: <1276820075-31310-1-git-send-email-mgoldish@redhat.com> <1276820075-31310-2-git-send-email-mgoldish@redhat.com> <1276820075-31310-3-git-send-email-mgoldish@redhat.com> <1276820075-31310-4-git-send-email-mgoldish@redhat.com> <1276820075-31310-5-git-send-email-mgoldish@redhat.com> <1276820075-31310-6-git-send-email-mgoldish@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: autotest@test.kernel.org, kvm@vger.kernel.org Return-path: In-Reply-To: <1276820075-31310-6-git-send-email-mgoldish@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: autotest-bounces@test.kernel.org Errors-To: autotest-bounces@test.kernel.org List-Id: kvm.vger.kernel.org Currently the error message appears twice: both in a logging.warn() statement and in an exception. Also the error.TestError raised adds unnecessary text to the exception message, which is informative enough as it is. Signed-off-by: Michael Goldish --- client/tests/kvm/kvm_preprocessing.py | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) diff --git a/client/tests/kvm/kvm_preprocessing.py b/client/tests/kvm/kvm_preprocessing.py index 84ad7c5..1ed4ec2 100644 --- a/client/tests/kvm/kvm_preprocessing.py +++ b/client/tests/kvm/kvm_preprocessing.py @@ -162,12 +162,10 @@ def process_command(test, params, env, command, command_timeout, try: utils.system("cd %s; %s" % (test.bindir, command)) except error.CmdError, e: - logging.warn("Custom processing command '%s' failed, output is: %s", - command, str(e)) - if not command_noncritical: - raise error.TestError("Custom processing command failed: %s" % - str(e)) - + if command_noncritical: + logging.warn(e) + else: + raise def process(test, params, env, image_func, vm_func): """ -- 1.5.4.1