added new parser for config
This commit is contained in:
parent
e6ca9b9840
commit
32a260b6e8
4 changed files with 213 additions and 25 deletions
|
|
@ -1,8 +1,28 @@
|
|||
class LayouException(Exception):
|
||||
def __init__(self, msg):
|
||||
self.msg = msg
|
||||
|
||||
def __str__(self):
|
||||
return repr(self.msg)
|
||||
|
||||
class Layout:
|
||||
def __init__(self, myLayout):
|
||||
self.name = myLayout
|
||||
self.enabled = False
|
||||
self.hostgroups = []
|
||||
def __init__(self, name, enabled = False , hostgroups=None):
|
||||
self._name = name
|
||||
self._enabled = enabled
|
||||
|
||||
if hostgroups is None or len(hostgroups) <= 0:
|
||||
raise Exception("Layout: " + name + " without hostgroups is useless")
|
||||
else:
|
||||
self._hostgroups = hostgroups
|
||||
|
||||
def get_name(self):
|
||||
return self._name
|
||||
|
||||
def is_enabled(self):
|
||||
return self._enabled
|
||||
|
||||
def get_hostgroups(self):
|
||||
return self._hostgroups
|
||||
|
||||
def __str__(self):
|
||||
ret = "Layout: 'Name:" + str(self.name) + "', 'Enabled: " + str(self.enabled) + " "
|
||||
|
|
@ -38,6 +58,7 @@ class LayoutList:
|
|||
else:
|
||||
# TODO: replace next line with new logging
|
||||
#logger.logWarningConfig(file="hostgroups", missing=group)
|
||||
pass
|
||||
self.layouts.append(l)
|
||||
|
||||
def __str__(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue