From cd8847ccfe8099e0c4d02a3f9a17232497787671 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 17 Oct 2012 19:43:46 +0200 Subject: moved template parameter to config file --- src/audio.json | 1 + src/flufigut.py | 9 +++++++-- src/test.json | 1 + src/test2.json | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/audio.json b/src/audio.json index d8bc0d9..435a5d9 100644 --- a/src/audio.json +++ b/src/audio.json @@ -1,5 +1,6 @@ { "globals":{ + "templates": "example", "version": "0.10.0", "name": "audio-only", "description": "Audio only test", diff --git a/src/flufigut.py b/src/flufigut.py index 2f3b2c2..d2ef659 100755 --- a/src/flufigut.py +++ b/src/flufigut.py @@ -47,7 +47,12 @@ def rand_string(size=8, chars=string.ascii_lowercase + string.ascii_uppercase + ### parse json file ############################################# # if len(sys.argv) <= 2: - raise SystemExit("ERROR: No template name and or configuration file given") + raise SystemExit("ERROR: No output format and or configuration file given") + +output_format = sys.argv[1] + +if output_format != 'flumotion': + raise SystemExit("OUTPUT FORMAT: currently only flumotion configuration files can be generated") cf = open(sys.argv[2], 'r') config = json.load(cf); @@ -365,7 +370,7 @@ if error != 0: import shutil shutil.rmtree('output', ignore_errors=True) -env = Environment(loader=FileSystemLoader('../templates/%s/' % (sys.argv[1])), line_statement_prefix = '%%') +env = Environment(loader=FileSystemLoader('../templates/%s/' % (globals['templates'])), line_statement_prefix = '%%') print "generating planet '%s/%s'" % (globals['manager']['machine'], globals['name']) template = env.get_template('planet.xml') diff --git a/src/test.json b/src/test.json index 3925c6a..56188fa 100644 --- a/src/test.json +++ b/src/test.json @@ -1,5 +1,6 @@ { "globals":{ + "templates": "example", "version": "0.10.0", "name": "elevate-live", "description": "Live from Elevate Festival 2012", diff --git a/src/test2.json b/src/test2.json index 1069187..7b66060 100644 --- a/src/test2.json +++ b/src/test2.json @@ -1,5 +1,6 @@ { "globals":{ + "templates": "example", "version": "0.10.0", "name": "elevate-live", "description": "Live from Elevate Festival 2012", -- cgit v1.2.3