aboutsummaryrefslogtreecommitdiff
path: root/mrbelvedere/template_parser.py
blob: 6217d302f11c96cfd140cdb6d83a6f79088b257c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
""" Parse build templates
"""
import yaml


class TemplateParser(object):

    def __init__(self):
        self.yaml = yaml
        self._current_template_file = None
        self.template_data = None

    @property
    def template_file(self):
        return self._current_template_file

    @template_file.setter
    def template_file(self, file):
        self._current_template_file = open(file)

    def load_template(self):
        self.template_data = self.yaml.load(self.template_file.read()).get('template')