def _make_chart(self):
     return Chart(
         metadata=Metadata(
             description='chart description',
             name='chart_name',
             version='0.1.2'),
         templates=[
             Template(
                 name='template_name', data='template content'.encode())
         ],
         files=[
             Any(type_url='./file_name.ext', value='file content'.encode())
         ],
         dependencies=[],
         values=Config(raw='{param: d1}'))
Example #2
0
    def get_templates(self):
        '''
        Return all the chart templates
        '''

        # process all files in templates/ as a template to attach to the chart
        # building a Template object
        templates = []
        if not os.path.exists(os.path.join(self.source_directory,
                                           'templates')):
            LOG.warn(
                "Chart %s has no templates directory,"
                "no templates will be deployed", self.chart.name)
        for root, _, files in os.walk(os.path.join(self.source_directory,
                                                   'templates'),
                                      topdown=True):
            for tpl_file in files:
                templates.append(
                    Template(name=tpl_file,
                             data=open(os.path.join(root, tpl_file),
                                       'r').read()))
        return templates
Example #3
0
 def update_chart(chart):
     chart.templates.extend([
         Template(name='new_template_name',
                  data='new template content'.encode())
     ])