From 1470595837163a649f860715d016b4782192611d Mon Sep 17 00:00:00 2001 From: Andrey Tykhonov Date: Thu, 10 Dec 2015 17:29:45 +0200 Subject: [PATCH] Fix indentations for the error messages When an error occures we can see surplus identations arround the messages. This patch fixes it. Change-Id: I7bd2a01d9bf31e6167b175258f7b1c103dd1f8f8 --- fuelclient/cli/error.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/fuelclient/cli/error.py b/fuelclient/cli/error.py index fe1d7f5..c768f56 100644 --- a/fuelclient/cli/error.py +++ b/fuelclient/cli/error.py @@ -17,6 +17,7 @@ import json from keystoneclient.exceptions import Unauthorized import requests import sys +import textwrap def exit_with_error(message): @@ -118,15 +119,17 @@ def exceptions_decorator(func): except requests.HTTPError as exc: exit_with_error("{0} ({1})".format(exc, get_error_body(exc))) except requests.ConnectionError: - exit_with_error(""" - Can't connect to Nailgun server! - Please check connection settings in your configuration file.""") + message = """ + Can't connect to Nailgun server! + Please check connection settings in your configuration file.""" + exit_with_error(textwrap.dedent(message).strip()) except Unauthorized: - exit_with_error(""" - Unauthorized: need authentication! - Please provide user and password via client - fuel --user=user --password=pass [action] - or modify your credentials in your configuration file.""") + message = """ + Unauthorized: need authentication! + Please provide user and password via client + fuel --user=user --password=pass [action] + or modify your credentials in your configuration file.""" + exit_with_error(textwrap.dedent(message).strip()) except FuelClientException as exc: exit_with_error(exc.message)