summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2006-01-26 23:39:55 +0000
committerStef Walter <stef@memberwebs.com>2006-01-26 23:39:55 +0000
commit154752ce6169093a36ffeb3cce3c408e1da2d3b2 (patch)
tree898f41ef9ed668ba94875a45c17cee3fb585420f /tools
parent9f63d4886d3a55cbe45c0ba57cb3b1e911654557 (diff)
Modify python helpers to use flat configuration file structure.
Diffstat (limited to 'tools')
-rw-r--r--tools/rrdui.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/tools/rrdui.py b/tools/rrdui.py
index ee10eae..a4debf4 100644
--- a/tools/rrdui.py
+++ b/tools/rrdui.py
@@ -18,10 +18,10 @@ class GraphDef:
__config = None
- def __init__(self, category, name):
- self.filename = "%s/%s/%s" % (CONFDIR, category, name)
- self.filedata = "%s/%s-%s.rrd" % (WORKDIR, category, name)
- self.category = category
+ def __init__(self, name):
+ self.filename = "%s/%s" % (CONFDIR, name)
+ self.filedata = "%s/%s.rrd" % (WORKDIR, name)
+ self.category = "All"
self.name = name
cfg = self.__config = ConfigParser.RawConfigParser()
@@ -30,6 +30,8 @@ class GraphDef:
# Loading general stuff
if cfg.has_option("general", "title"):
self.title = cfg.get("general", "title")
+ if cfg.has_option("general", "category"):
+ self.title = cfg.get("general", "category")
# Loading graph stuff
if cfg.has_option("graph", "width"):
@@ -85,12 +87,10 @@ def loadGraphs():
# List files and add appropriate paths
graphs = []
- for category in os.listdir(CONFDIR):
- dir = "%s/%s" % (CONFDIR, category)
- if not os.path.isdir(dir):
+ for file in os.listdir(CONFDIR):
+ if os.path.isdir(file):
continue
- for f in os.listdir(dir):
- graphs.append(GraphDef(category, f))
+ graphs.append(GraphDef(file))
return graphs