Skip to content

Commit

Permalink
git repositories as templates & code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Fiers committed Sep 28, 2012
1 parent d35e034 commit 5ab5e0e
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions lib/python/moa/template/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"""

import os
import copy

import Yaco

Expand All @@ -28,7 +27,7 @@ class Template(Yaco.Yaco):
Template extends Yaco
"""

def __init__(self, templateFile):
def __init__(self, wd):
"""
Initialze the template object, which means:
Expand All @@ -46,7 +45,18 @@ def __init__(self, templateFile):

super(Template, self).__init__(self)

self.templateFile = templateFile
templateFile1 = os.path.join('.moa', 'template.d', 'template')
templateFile2 = os.path.join('.moa', 'template')

self.metaFile = os.path.join('.moa', 'template.meta')
self.loadMeta()

if os.path.exists(templateFile1):
self.templateFile = templateFile1
elif os.path.exists(templateFile2):
self.templateFile = templateFile2
else:
self.templateFile = templateFile1

#set a few defaults to be used by each template
self.parameters = {}
Expand Down Expand Up @@ -102,6 +112,15 @@ def __init__(self, templateFile):
if not self.name == 'nojob' and not self.modification_date:
self.modification_date = os.path.getmtime(self.templateFile)

def loadMeta(self):
"""
Load the template meta data for this job, based on what configuration
can be found
"""
self.meta = Yaco.Yaco()
if os.path.exists(self.metaFile):
self.templateMeta.load(self.metaFile)

def getRaw(self):
"""
Return a Yaco representation of the yaml-template, without any
Expand Down

0 comments on commit 5ab5e0e

Please sign in to comment.