print hint if initial manifest is missing

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
Nico Schottelius 2012-11-06 21:46:02 +01:00
parent 866f23ea2c
commit aedb3669c7
3 changed files with 3 additions and 18 deletions

View file

@ -87,6 +87,6 @@ class Context(object):
def filter(self, record): def filter(self, record):
"""Add hostname to logs via logging Filter""" """Add hostname to logs via logging Filter"""
record.msg = self.target_host + ": " + record.msg record.msg = self.target_host + ": " + str(record.msg)
return True return True

View file

@ -25,20 +25,6 @@ import os
import cdist 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: common:
runs only locally, does not need remote runs only locally, does not need remote
@ -100,8 +86,7 @@ class Manifest(object):
self.log.info("Running initial manifest " + self.local.manifest_path) self.log.info("Running initial manifest " + self.local.manifest_path)
if not os.path.isfile(self.local.manifest_path): if not os.path.isfile(self.local.manifest_path):
print("fooooobar") raise cdist.Error("Initial manifest is missing")
raise NoInitialManifestError(self.local.manifest_path)
self.local.run_script(script, env=env) self.local.run_script(script, env=env)

View file

@ -181,9 +181,9 @@ def configinstall_onehost(host, args, mode, parallel):
context.cleanup() context.cleanup()
except cdist.Error as e: except cdist.Error as e:
context.log.error(e)
# We are running in our own process here, need to sys.exit! # We are running in our own process here, need to sys.exit!
if parallel: if parallel:
log.error(e)
sys.exit(1) sys.exit(1)
else: else:
raise raise