54 lines
2.2 KiB
Django/Jinja
54 lines
2.2 KiB
Django/Jinja
# -*- coding: utf-8 -*-
|
|
# vim: ft=jinja
|
|
|
|
{%- set tplroot = tpldir.split('/')[0] %}
|
|
{%- import_yaml tplroot ~ "/defaults.yaml" as default_settings %}
|
|
{%- import_yaml tplroot ~ "/osarchmap.yaml" as osarchmap %}
|
|
{%- import_yaml tplroot ~ "/osfamilymap.yaml" as osfamilymap %}
|
|
{%- set _config = salt['config.get'](tplroot, default={}) %}
|
|
|
|
{%- set defaults = salt['grains.filter_by'](
|
|
default_settings,
|
|
default=tplroot,
|
|
merge=salt['grains.filter_by']( osfamilymap, grain='os_family',
|
|
merge=salt['grains.filter_by']( osarchmap, grain='osarch',
|
|
merge=salt['grains.filter_by']( _config, default='lookup'
|
|
)
|
|
)
|
|
)
|
|
)
|
|
%}
|
|
|
|
{%- set p = salt['grains.filter_by']( {'defaults': defaults}, default='defaults', merge=_config) %}
|
|
|
|
{# ## components ## #}
|
|
{%- if 'component' in p.pkg and p.pkg.component is mapping %}
|
|
{%- for name,v in p.pkg.component.items() %}
|
|
{%- set url = None %}
|
|
{%- set dir = name %}
|
|
{%- if 'version' in v and v.version and 'archive' in v and v.archive and 'uri' in p.pkg %}
|
|
{%- set uri = '%s/%s/releases/download/%s/%s'|format(p.pkg.uri, name, v.version, name) %}
|
|
{%- set url = '%s-%s.%s-%s.tar.gz'|format(uri, v.version|replace('v',''), p.kernel, p.arch) %}
|
|
{%- set dir = '%s-%s'|format(name, v.version) %}
|
|
{%- do p.pkg.component[name].update({'path': p.dir.archive ~ '/' + dir }) %}
|
|
{%- do p.pkg.component[name]['archive'].update({'name': p.dir.archive + '/' + dir, 'source': url}) %}
|
|
{%- endif %}
|
|
{%- endfor %}
|
|
{%- endif %}
|
|
|
|
{# ## clientlibs ## #}
|
|
{%- if 'clientlibs' in p.pkg and p.pkg.clientlibs is mapping %}
|
|
{%- for name,v in p.pkg.clientlibs.items() %}
|
|
{%- set url = None %}
|
|
{%- set dir = name %}
|
|
{%- if 'version' in v and v.version and 'archive' in v and v.archive and 'uri' in v.archive %}
|
|
{%- set url = v.archive.uri ~ '/' ~ v.version ~ '.tar.gz' %}
|
|
{%- set dir = name ~ '-' ~ v.version %}
|
|
{%- endif %}
|
|
{%- do p.pkg.clientlibs[name].update({'path': p.dir.archive ~ '/' + dir }) %}
|
|
{%- do p.pkg.clientlibs[name]['archive'].update({'name': p.dir.archive + '/' + dir, 'source': url}) %}
|
|
{%- endfor %}
|
|
{%- endif %}
|
|
|
|
{%- set prometheus = p %}
|