prometheus-formula/prometheus/map.jinja

57 lines
2.4 KiB
Plaintext
Raw Normal View History

# -*- 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 ~ "/cpuarchmap.yaml" as cpuarchmap %}
2019-06-20 02:36:58 +02:00
{%- 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']( cpuarchmap, grain='cpuarch',
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 %}
feat(yamllint): include for this repo and apply rules throughout * Semi-automated using `ssf-formula` (v0.5.0) * Fix errors shown below: ```bash prometheus-formula$ $(grep "\- yamllint" .travis.yml | sed -e "s:^\s\+-\s\(.*\):\1:") ./prometheus/osfamilymap.yaml 1:89 error line too long (116 > 88 characters) (line-length) 1:24 error trailing spaces (trailing-spaces) 13:2 error syntax error: found character '%' that cannot start any token 24:89 error line too long (90 > 88 characters) (line-length) 25:89 error line too long (167 > 88 characters) (line-length) ./prometheus/defaults.yaml 6:13 error too many spaces inside braces (braces) 6:35 error too many spaces inside braces (braces) 7:11 error too many spaces inside braces (braces) 7:25 error too many spaces inside braces (braces) 8:22 warning truthy value should be one of [false, true] (truthy) 9:25 warning truthy value should be one of [false, true] (truthy) 49:85 error trailing spaces (trailing-spaces) 103:20 warning truthy value should be one of [false, true] (truthy) 104:25 warning truthy value should be one of [false, true] (truthy) 108:16 warning truthy value should be one of [false, true] (truthy) 113:24 warning missing starting space in comment (comments) pillar.example 31:6 warning missing starting space in comment (comments) 32:8 warning missing starting space in comment (comments) 32:7 warning comment not indented like content (comments-indentation) 51:5 warning comment not indented like content (comments-indentation) 65:89 error line too long (110 > 88 characters) (line-length) 68:29 error too many spaces after colon (colons) 68:34 warning too few spaces before comment (comments) 68:89 error line too long (106 > 88 characters) (line-length) 69:34 warning too few spaces before comment (comments) 69:89 error line too long (98 > 88 characters) (line-length) 75:9 error wrong indentation: expected 10 but found 8 (indentation) 76:11 error wrong indentation: expected 12 but found 10 (indentation) 77:13 warning comment not indented like content (comments-indentation) 79:89 error line too long (101 > 88 characters) (line-length) 81:9 warning comment not indented like content (comments-indentation) 86:89 error line too long (103 > 88 characters) (line-length) 91:11 error wrong indentation: expected 12 but found 10 (indentation) 106:15 error wrong indentation: expected 16 but found 14 (indentation) 108:41 warning too few spaces before comment (comments) 118:89 error line too long (96 > 88 characters) (line-length) 139:13 error wrong indentation: expected 14 but found 12 (indentation) 143:7 error wrong indentation: expected 8 but found 6 (indentation) 145:9 error wrong indentation: expected 10 but found 8 (indentation) 157:6 warning missing starting space in comment (comments) 158:20 error too many spaces inside braces (braces) 158:47 error too many spaces inside braces (braces) ```
2019-08-06 21:57:50 +02:00
{%- endif %}
{%- set prometheus = p %}