summaryrefslogtreecommitdiff
path: root/src/flufig.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/flufig.py')
-rwxr-xr-xsrc/flufig.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/flufig.py b/src/flufig.py
index c2c58c7..ea1a4fa 100755
--- a/src/flufig.py
+++ b/src/flufig.py
@@ -5,16 +5,17 @@
# flufig is a simple flumotion configuration generator using
# pyhton jinja2 template engine and simplejson. flufig generates
# planet.xml and worker.xml files from configuration templates and
-# a easy representation of the flow structure written in json.
+# an easy representation of the flow structure written in json.
#
#
# Copyright (C) 2012 Christian Pointner <equinox@spreadspace.org>
+# Michael Gebetsroither <michael@mgeb.org>
#
# This file is part of flufig.
#
# flufig is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
+# the Free Software Foundation, either version 2 of the License, or
# any later version.
#
# flufig is distributed in the hope that it will be useful,
@@ -27,15 +28,18 @@
#
import sys
+import simplejson as json
from exceptions import *
from jinja2 import Environment, FileSystemLoader
if len(sys.argv) <= 2:
raise SystemExit("No template and or data file given")
-data = [];
+df = open(sys.argv[2], 'r')
+data = json.load(df);
+df.close();
env = Environment(loader=FileSystemLoader('../templates/%s/' % (sys.argv[1])))
template = env.get_template('planet.xml')
-planet = template.render(data)
+planet = template.render(globals=data['globals'], atmosphere=data['atmosphere'], flow=data['flow'])
sys.stdout.write(planet.encode("utf8"))