Commit ffc617a0 authored by Ad Schellevis's avatar Ad Schellevis

fix configd (check_reload_status), plugin support broke the main service....

parent 6c413a95
...@@ -194,10 +194,15 @@ class ActionHandler(object): ...@@ -194,10 +194,15 @@ class ActionHandler(object):
self.action_map = {} self.action_map = {}
for config_filename in glob.glob('%s/actions_*.conf'%(self.config_path)) + glob.glob('%s/actions.d/actions_*.conf'%(self.config_path)): for config_filename in glob.glob('%s/actions_*.conf'%(self.config_path)) + glob.glob('%s/actions.d/actions_*.conf'%(self.config_path)):
# this topic's name (service, filter, template, etc)
# make sure there's an action map index for this topic
topic_name = config_filename.split('actions_')[-1].split('.')[0]
if self.action_map.has_key(topic_name) == False:
self.action_map[topic_name] = {}
# traverse config directory and open all filenames starting with actions_ # traverse config directory and open all filenames starting with actions_
cnf=ConfigParser.RawConfigParser() cnf=ConfigParser.RawConfigParser()
cnf.read(config_filename) cnf.read(config_filename)
topic_map = {}
for section in cnf.sections(): for section in cnf.sections():
# map configuration data on object # map configuration data on object
action_obj = Action() action_obj = Action()
...@@ -207,14 +212,12 @@ class ActionHandler(object): ...@@ -207,14 +212,12 @@ class ActionHandler(object):
if section.find('.') > -1: if section.find('.') > -1:
# at this moment we only support 2 levels of actions ( 3 if you count topic as well ) # at this moment we only support 2 levels of actions ( 3 if you count topic as well )
for alias in section.split('.')[0].split('|'): for alias in section.split('.')[0].split('|'):
if topic_map.has_key(alias) == False: if self.action_map[topic_name].has_key(alias) == False:
topic_map[alias] = {} self.action_map[topic_name][alias] = {}
topic_map[alias][section.split('.')[1]] = action_obj self.action_map[topic_name][alias][section.split('.')[1]] = action_obj
else: else:
for alias in section.split('|'): for alias in section.split('|'):
topic_map[alias] = action_obj self.action_map[topic_name][alias] = action_obj
self.action_map[config_filename.split('actions_')[-1].split('.')[0]] = topic_map
def findAction(self,command,action,parameters): def findAction(self,command,action,parameters):
""" find action object """ find action object
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment