renamed filters to tasks... members.py needs some fixes now. think it is a good style to manage post processing.
This commit is contained in:
parent
533cf02c10
commit
851069cc2a
8 changed files with 55 additions and 48 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import json
|
||||
from filters import parseFilterList
|
||||
from tasks import parseTaskList
|
||||
from members import parseMemberList
|
||||
from periods import parsePeriodList
|
||||
#from hostgroups import parseHostGroupList
|
||||
|
|
@ -15,8 +15,8 @@ class Config:
|
|||
|
||||
self.dict = json.loads(self.config)
|
||||
|
||||
self.filters = parseFilterList(self.dict['filters'])
|
||||
self.members = parseMemberList(self.dict['members'], self.filters, log)
|
||||
self.tasks = parseTaskList(self.dict['tasks'])
|
||||
self.members = parseMemberList(self.dict['members'], self.tasks, log)
|
||||
self.periods = parsePeriodList(self.dict['periods'], log)
|
||||
#self.hostgroups = parseHostGroupList(self.dict['hostgroups'],
|
||||
# self.members,
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
class Filter:
|
||||
def __init__(self, name="", command="", priority=0, comment=""):
|
||||
self.name = name
|
||||
self.command = command
|
||||
self.priority = priority
|
||||
self.comment = comment
|
||||
|
||||
def __str__(self):
|
||||
return "Filter('Name: " + self.name + "', 'Command: " + self.command + "', 'Priority: " + str(
|
||||
self.priority) + "')"
|
||||
|
||||
def clone(self):
|
||||
return Filter(self.name, self.command, self.priority, self.comment)
|
||||
|
||||
|
||||
def parseFilterList(filters):
|
||||
return [Filter(name, **values) for name, values in filters.items()]
|
||||
16
lib/config/tasks.py
Normal file
16
lib/config/tasks.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
class Task:
|
||||
def __init__(self, name="", command="", priority=0, comment=""):
|
||||
self.name = name
|
||||
self.command = command
|
||||
self.priority = priority
|
||||
self.comment = comment
|
||||
|
||||
def __str__(self):
|
||||
return "Task('Name: " + self.name + "', 'Command: " + self.command + "', 'Priority: " + str(self.priority) + "')"
|
||||
|
||||
def clone(self):
|
||||
return Task(self.name, self.command, self.priority, self.comment)
|
||||
|
||||
|
||||
def parseTaskList(tasks):
|
||||
return [Task(name, **values) for name, values in tasks.items()]
|
||||
Loading…
Add table
Add a link
Reference in a new issue