Skip to content

Commit

Permalink
fix(suse): bypass salt alternatives.install errors
Browse files Browse the repository at this point in the history
  • Loading branch information
noelmcloughlin committed Jun 23, 2019
1 parent c735a6d commit 1a890e5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
1 change: 0 additions & 1 deletion kitchen.yml
Expand Up @@ -42,7 +42,6 @@ provisioner:
base:
'*':
- prometheus
- prometheus.exporters
pillars:
top.sls:
base:
Expand Down
14 changes: 8 additions & 6 deletions pillar.example
Expand Up @@ -4,12 +4,14 @@
prometheus:
wanted:
- prometheus
- pushgateway
{%- if grains.os_family not in ('Debian',) %}
- alertmanager
{%- endif %}
- node_explorer
# no memcached_exporter in upstream repo - only archive
# memcached_exporter

use_upstream_archive: True
use_upstream_archive: False
{%- if grains.os_family in ('CentOS',) %}
use_upstream_repo: False
{%- endif %}
Expand All @@ -26,10 +28,10 @@ prometheus:
prometheus:
args:
web.listen-address: 0.0.0.0:9090
pushgateway:
args:
web.listen-address: ":9091"
web.telemetry-path: "/metrics"
#pushgateway:
#args:
# web.listen-address: ":9091"
# web.telemetry-path: "/metrics"
node_exporter:
args:
web.listen-address: ":9110"
Expand Down
12 changes: 8 additions & 4 deletions prometheus/archive/alternatives/install.sls
Expand Up @@ -18,7 +18,7 @@ include:
prometheus-archive-alternatives-install-{{ name }}-home-cmd-run:
cmd.run:
- name: update-alternatives --install {{ p.dir.basedir }}/{{ bundle }} prometheus-{{ name }}-home {{ p.dir.basedir }}/{{ bundle }} {{p.linux.altpriority}}
- name: update-alternatives --install {{ p.dir.basedir }}/{{ name }} prometheus-{{ name }}-home {{ p.dir.basedir }}/{{ bundle }} {{p.linux.altpriority}}
- watch:
- archive: prometheus-archive-install-{{ name }}-archive-extracted
Expand All @@ -45,13 +45,18 @@ prometheus-archive-alternatives-install-{{ name }}-home-alternatives-set:
{%- endif %}
{% for b in p.pkg[name]['binaries'] %}
{%- if grains.os_family == 'Suse' %}
prometheus-archive-alternatives-install-{{ name }}-alternatives-install-{{ b }}:
prometheus-archive-alternatives-install-{{ name }}-cmd-run-{{ b }}-alternative:
cmd.run:
- onlyif: {{ grains.os_family in ('Suse',) }}
- name: update-alternatives --install /usr/local/bin/{{ b }} prometheus-{{ name }}-{{ b }} {{ p.dir.basedir }}/{{ bundle }}/{{ b }} {{ p.linux.altpriority }}
- require:
- cmd: prometheus-archive-alternatives-install-{{ name }}-home-cmd-run
{%- else %}
prometheus-archive-alternatives-install-{{ name }}-alternatives-install-{{ b }}:
alternatives.install:
- name: prometheus-{{ name }}-{{ b }}
- link: /usr/local/bin/{{ b }}
Expand All @@ -60,16 +65,15 @@ prometheus-archive-alternatives-install-{{ name }}-alternatives-install-{{ b }}:
- order: 10
- require:
- alternatives: prometheus-archive-alternatives-install-{{ name }}-home-alternatives-install
- onlyif: {{ grains.os_family not in ('Suse',) }}
prometheus-archive-alternatives-install-{{ name }}-alternatives-set-{{ b }}:
alternatives.set:
- name: prometheus-{{ name }}-{{ b }}
- path: {{ p.dir.basedir }}/{{ bundle }}/{{ b }}
- require:
- alternatives: prometheus-archive-alternatives-install-{{ name }}-alternatives-install-{{ b }}
- onlyif: {{ grains.os_family not in ('Suse',) }}
{%- endif %}
{% endfor %}
{% endfor %}
{%- endif %}

0 comments on commit 1a890e5

Please sign in to comment.