Merge pull request #38 from noelmcloughlin/i16

fix(linux): service.args is freebsd
This commit is contained in:
N 2020-08-19 01:28:28 +02:00 committed by GitHub
commit a0cec39d35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 11 deletions

View File

@ -15,8 +15,8 @@ prometheus-archive-install-prerequisites:
- names: {{ p.pkg.deps|json }} - names: {{ p.pkg.deps|json }}
file.directory: file.directory:
- name: {{ p.dir.var }} - name: {{ p.dir.var }}
- user: prometheus - user: {{ p.identity.rootuser }}
- group: prometheus - group: {{ p.identity.rootgroup }}
- mode: 755 - mode: 755
- makedirs: True - makedirs: True
- require: - require:

View File

@ -4,6 +4,8 @@
{%- set tplroot = tpldir.split('/')[0] %} {%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %} {%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %} {%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
{%- if grains.os_family in ('FreeBSD',) %}
{%- set sls_service_clean = tplroot ~ '.service.clean' %} {%- set sls_service_clean = tplroot ~ '.service.clean' %}
include: include:
@ -36,3 +38,4 @@ prometheus-service-args-clean-{{ name }}:
{%- endif %} {%- endif %}
{%- endfor %} {%- endfor %}
{%- endif %}

View File

@ -4,7 +4,10 @@
{%- set tplroot = tpldir.split('/')[0] %} {%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %} {%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %} {%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
{%- if grains.os_family in ('FreeBSD',) %}
{%- set sls_config_users = tplroot ~ '.config.users' %} {%- set sls_config_users = tplroot ~ '.config.users' %}
{%- set sls_service_running = tplroot ~ '.service.running' %}
{%- set sls_archive_install = tplroot ~ '.archive.install' %} {%- set sls_archive_install = tplroot ~ '.archive.install' %}
{%- set sls_package_install = tplroot ~ '.package.install' %} {%- set sls_package_install = tplroot ~ '.package.install' %}
@ -12,6 +15,7 @@
include: include:
- {{ sls_archive_install if p.pkg.use_upstream_archive else sls_package_install }} - {{ sls_archive_install if p.pkg.use_upstream_archive else sls_package_install }}
- {{ sls_config_users }} - {{ sls_config_users }}
- {{ sls_service_running }}
{%- for name in p.wanted.component %} {%- for name in p.wanted.component %}
{%- if 'service' in p.pkg.component[name] and 'args' in p.pkg.component[name]['service'] %} {%- if 'service' in p.pkg.component[name] and 'args' in p.pkg.component[name]['service'] %}
@ -73,3 +77,4 @@ prometheus-service-args-{{ name }}-install:
{%- endif %} {%- endif %}
{%- endif %} {%- endif %}
{%- endfor %} {%- endfor %}
{%- endif %}

View File

@ -5,10 +5,8 @@
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %} {%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
{%- set sls_config_file = tplroot ~ '.config.file' %} {%- set sls_config_file = tplroot ~ '.config.file' %}
{%- set sls_config_environ = tplroot ~ '.config.environ' %} {%- set sls_config_environ = tplroot ~ '.config.environ' %}
{%- set sls_service_args = tplroot ~ '.service.args.install' %}
include: include:
- {{ sls_service_args }}
- {{ sls_config_file }} - {{ sls_config_file }}
- {{ sls_config_environ }} - {{ sls_config_environ }}
@ -25,7 +23,6 @@ prometheus-service-running-{{ name }}-unmasked:
- require_in: - require_in:
- service: prometheus-service-running-{{ name }} - service: prometheus-service-running-{{ name }}
- require: - require:
- sls: {{ sls_service_args }}
- sls: {{ sls_config_file }} - sls: {{ sls_config_file }}
- file: prometheus-config-file-etc-file-directory - file: prometheus-config-file-etc-file-directory
@ -39,7 +36,6 @@ prometheus-service-running-{{ name }}:
- onlyif: systemctl list-units | grep {{ service_name }} >/dev/null 2>&1 - onlyif: systemctl list-units | grep {{ service_name }} >/dev/null 2>&1
- enable: True - enable: True
- require: - require:
- sls: {{ sls_service_args }}
- sls: {{ sls_config_file }} - sls: {{ sls_config_file }}
- names: - names:
- {{ service_name }} - {{ service_name }}

View File

@ -26,7 +26,6 @@ control 'prometheus components' do
end end
describe directory('/var/lib/prometheus') do describe directory('/var/lib/prometheus') do
it { should exist } it { should exist }
its('group') { should eq 'prometheus' }
end end
describe directory('/opt/prometheus/prometheus-v2.10.0') do describe directory('/opt/prometheus/prometheus-v2.10.0') do
it { should exist } it { should exist }