just some housekeeping... :) i like!

This commit is contained in:
Johannes Findeisen 2013-09-21 04:44:01 +02:00
commit 663007a237
4 changed files with 45 additions and 64 deletions

View file

@ -13,16 +13,16 @@ from lib.processors.processor import Processor
from lib.parsers.parser import Parser
from lib.tasks.task import Task
MOD_SERVICES = "services"
MOD_PROCESSORS = "processors"
MOD_PARSERS = "parsers"
MOD_TASKS = "tasks"
MOD_SERVICES = "services"
MOD_PROCESSORS = "processors"
MOD_PARSERS = "parsers"
MOD_TASKS = "tasks"
KEY_LAYOUTS = "layouts"
KEY_HOSTGROUPS = "hostgroups"
KEY_MEMBERS = "members"
KEY_PERIODS = "periods"
KEY_CORE = "core"
KEY_LAYOUTS = "layouts"
KEY_HOSTGROUPS = "hostgroups"
KEY_MEMBERS = "members"
KEY_PERIODS = "periods"
KEY_CORE = "core"
class ConfigurationException(Exception):
@ -135,10 +135,10 @@ class ConfigParser:
if class_check(item):
repl.append(item)
else:
self.log.w(" ignoring class " + clazzItem["class"] + "! It does not pass the class check!")
self.log.w("Ignoring class " + clazzItem["class"] + "! It does not pass the class check!")
except ImportError, err:
self.log.w("could not import " + clazz + ": " + str(clazzItem) + "! reason")
self.log.w("Could not import " + clazz + ": " + str(clazzItem) + "! reason")
self.log.w(str(err))
except KeyError, k:
self.log.w("Key " + str(k) + " not in classItem " + str(clazzItem))
@ -202,8 +202,6 @@ class FullConfigParser(ConfigParser):
"""
self.jsonDict = self._read_json_config(configFilename)
# first step
creator = lambda name, values: Layout(name,**values)
layouts = self._create_raw_Object(self.jsonDict[KEY_LAYOUTS], "Layout", creator)

View file

@ -10,7 +10,7 @@ import os
from shlex import split as shsplit
from cmd import Cmd
VERSION = "0.1"
__version__ = "0.1"
class LishFrontend(Frontend):
@ -23,7 +23,7 @@ class LishFrontend(Frontend):
run = True
while run:
try:
commander.cmdloop("LISH - Linspector interactive shell")
commander.cmdloop("Lish - Linspector interactive shell (" + __version__ + ")")
except KeyboardInterrupt, ki:
run = False
except Exception, err:
@ -80,7 +80,7 @@ class ShellCommander(CommandBase, object):
os.system(text)
def help_shell(self):
print("execute any shell command. Can also be achieved by a '!' postfix")
print("execute any shell command. Can also be achieved by a '!' prefix")
def complete_shell(self, text, line, begidx, endidx):
try:
@ -158,9 +158,6 @@ class LishCommander(Exit, ShellCommander, LogCommander):
executes python using 'exec'.
'''
def help_hostgroup(self):
print '''
usage:
@ -172,4 +169,4 @@ class LishCommander(Exit, ShellCommander, LogCommander):
def complete_hostgroup(self, text, line, begidx, endidx):
if begidx == 10:
return [x for x in self._hostgroupArgs if x.startswith(text)] if len(text) > 0 else self._hostgroupArgs
return [x for x in self._hostgroupArgs if x.startswith(text)] if len(text) > 0 else self._hostgroupArgs

View file

@ -24,6 +24,7 @@ class MailTask(Task):
message['Subject'] = msg
now = datetime.datetime.now()
message['Date'] = now.strftime("%a, %d %b %Y %H:%M:%S")
#TODO: totally unstable just to use values from core. make checks before...!
message['From'] = core["tasks"]["mail"]["from"]
message['To'] = self.recipient
s = smtplib.SMTP(core["tasks"]["mail"]["host"], core["tasks"]["mail"]["port"])