From aedb3669c74e786c312fd261d74182077b51ecd4 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 6 Nov 2012 21:46:02 +0100 Subject: [PATCH] print hint if initial manifest is missing Signed-off-by: Nico Schottelius --- cdist/context.py | 2 +- cdist/core/manifest.py | 17 +---------------- scripts/cdist | 2 +- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/cdist/context.py b/cdist/context.py index 2855f228..767b17a8 100644 --- a/cdist/context.py +++ b/cdist/context.py @@ -87,6 +87,6 @@ class Context(object): def filter(self, record): """Add hostname to logs via logging Filter""" - record.msg = self.target_host + ": " + record.msg + record.msg = self.target_host + ": " + str(record.msg) return True diff --git a/cdist/core/manifest.py b/cdist/core/manifest.py index ecc4a490..61d92992 100644 --- a/cdist/core/manifest.py +++ b/cdist/core/manifest.py @@ -25,20 +25,6 @@ import os import cdist -class NoInitialManifestError(cdist.Error): - """ - Display missing initial manifest - """ - - def __init__(self, manifest_path): - if os.path.islink(manifest_path): - self.message = "%s -> %s" (manifest_path, os.path.realpath(manifest_path)) - else: - self.message = manifest_path - - def __str__(self): - return "Initial manifest missing: %s" % self.message - ''' common: runs only locally, does not need remote @@ -100,8 +86,7 @@ class Manifest(object): self.log.info("Running initial manifest " + self.local.manifest_path) if not os.path.isfile(self.local.manifest_path): - print("fooooobar") - raise NoInitialManifestError(self.local.manifest_path) + raise cdist.Error("Initial manifest is missing") self.local.run_script(script, env=env) diff --git a/scripts/cdist b/scripts/cdist index 00ebbf18..fd18933a 100755 --- a/scripts/cdist +++ b/scripts/cdist @@ -181,9 +181,9 @@ def configinstall_onehost(host, args, mode, parallel): context.cleanup() except cdist.Error as e: + context.log.error(e) # We are running in our own process here, need to sys.exit! if parallel: - log.error(e) sys.exit(1) else: raise