Commit 43f3ae57 authored by Ad Schellevis's avatar Ad Schellevis

(configd) configd actions missed second level actions, output is fine now but...

(configd) configd actions missed second level actions, output is fine now but nesting actions may need some more thinking
parent bd5f92be
...@@ -285,13 +285,25 @@ class ActionHandler(object): ...@@ -285,13 +285,25 @@ class ActionHandler(object):
result = {} result = {}
for command in self.action_map: for command in self.action_map:
for action in self.action_map[command]: for action in self.action_map[command]:
cmd='%s %s'%(command,action) if type(self.action_map[command][action]) == dict:
result[cmd] = {} # parse second level actions
for actAttr in attributes: # TODO: nesting actions may be better to solve recursive in here and in load_config part
if hasattr(self.action_map[command][action], actAttr): for subAction in self.action_map[command][action]:
result[cmd][actAttr] = getattr(self.action_map[command][action], actAttr) cmd='%s %s %s'%(command,action,subAction)
else: result[cmd] = {}
result[cmd][actAttr] = '' for actAttr in attributes:
if hasattr(self.action_map[command][action][subAction], actAttr):
result[cmd][actAttr] = getattr(self.action_map[command][action][subAction], actAttr)
else:
result[cmd][actAttr] = ''
else:
cmd='%s %s'%(command,action)
result[cmd] = {}
for actAttr in attributes:
if hasattr(self.action_map[command][action], actAttr):
result[cmd][actAttr] = getattr(self.action_map[command][action], actAttr)
else:
result[cmd][actAttr] = ''
return result return result
......
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