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):
"""Add hostname to logs via logging Filter"""
record.msg = self.target_host + ": " + record.msg
record.msg = self.target_host + ": " + str(record.msg)
return True

View File

@ -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)

View File

@ -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