예제 #1
0
    def _render_action(self, resource, action):
        log.debug('Rendering %s %s', resource.name, action)

        action_file = resource.actions[action]
        log.debug('action file: %s', action_file)
        args = self._make_args(resource)

        return utils.render_template(action_file, str=str, zip=zip, **args)
예제 #2
0
파일: main.py 프로젝트: sand8080/solar
def profile(id, tags, create):
    if not id:
        id = utils.generate_uuid()
    if create:
        params = {'tags': tags, 'id': id}
        profile_template_path = os.path.join(
            utils.read_config()['template-dir'], 'profile.yml')
        data = yaml.load(utils.render_template(profile_template_path, params))
        db.store('profiles', data)
    else:
        pprint.pprint(db.get_list('profiles'))
예제 #3
0
파일: base.py 프로젝트: Mirantis/solar
    def _render_action(self, resource, action):
        log.debug('Rendering %s %s', resource.name, action)

        action_file = resource.actions[action]
        log.debug('action file: %s', action_file)
        args = self._make_args(resource)

        return utils.render_template(
            action_file,
            str=str,
            zip=zip,
            **args)
예제 #4
0
 def _render_dir(self, resource, _path):
     args = self._make_args(resource)
     for f in os.listdir(_path):
         if f.endswith('.jinja'):
             target_f = f[:-6]
             full_target = os.path.join(_path, target_f)
             full_src = os.path.join(_path, f)
             with open(full_target, 'wb') as tmpl_f:
                 tpl = utils.render_template(full_src,
                                             str=str,
                                             zip=zip,
                                             **args)
                 tmpl_f.write(tpl)
             log.debug("Rendered: %s", full_target)
             os.remove(full_src)
예제 #5
0
파일: base.py 프로젝트: Mirantis/solar
 def _render_dir(self, resource, _path):
     args = self._make_args(resource)
     for f in os.listdir(_path):
         if f.endswith('.jinja'):
             target_f = f[:-6]
             full_target = os.path.join(_path, target_f)
             full_src = os.path.join(_path, f)
             with open(full_target, 'wb') as tmpl_f:
                 tpl = utils.render_template(
                     full_src,
                     str=str,
                     zip=zip,
                     **args)
                 tmpl_f.write(tpl)
             log.debug("Rendered: %s", full_target)
             os.remove(full_src)