+print cdist version on startup + exit_code = 2 for irq

Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
Nico Schottelius 2013-08-21 18:52:35 +02:00
parent 408d89433b
commit 74e003d29b
2 changed files with 4 additions and 14 deletions

View file

@ -23,21 +23,15 @@
import logging import logging
class Log(logging.Logger): class Log(logging.Logger):
"""Hold information about current context"""
def __init__(self, name): def __init__(self, name):
# Context logging
self.name = name self.name = name
# Init real logger
super().__init__(name) super().__init__(name)
# Add ourselves as a filter
self.addFilter(self) self.addFilter(self)
def filter(self, record): def filter(self, record):
"""Add hostname to logs via logging Filter""" """Prefix messages with logger name"""
record.msg = self.name + ": " + str(record.msg) record.msg = self.name + ": " + str(record.msg)

View file

@ -114,6 +114,7 @@ def commandline():
logging.root.setLevel(logging.DEBUG) logging.root.setLevel(logging.DEBUG)
log.debug(args) log.debug(args)
log.info("version %s" % cdist.VERSION)
# Work around python 3.3 bug: # Work around python 3.3 bug:
# http://bugs.python.org/issue16308 # http://bugs.python.org/issue16308
@ -171,16 +172,11 @@ if __name__ == "__main__":
commandline() commandline()
except KeyboardInterrupt: except KeyboardInterrupt:
pass exit_code = 2
# FIXME: We always get exit code = 130
# exit_code = 2
# does not make a difference
except cdist.Error as e: except cdist.Error as e:
log.error(e) log.error(e)
exit_code = 1 exit_code = 1
#sys.exit(20)
# print("ok2 %s" % exit_code) # print("ok2 %s" % exit_code)
sys.exit(exit_code) sys.exit(exit_code)