From f2261f9dc958792a16c13a6380386a1f7239f386 Mon Sep 17 00:00:00 2001 From: BlueWolf Date: Thu, 24 Jun 2021 17:25:35 +0100 Subject: [PATCH] fix: revert to use of macro.jinja for arg handling The previous additions to environ.sh.jinja were fixing something that wasnt broken. --- kitchen.yml | 1 + prometheus/config/environ.sls | 2 +- prometheus/defaults.yaml | 6 ++--- prometheus/files/default/environ.sh.jinja | 4 +-- test/salt/pillar/default.sls | 32 +++++++++++++---------- 5 files changed, 25 insertions(+), 20 deletions(-) diff --git a/kitchen.yml b/kitchen.yml index e7cf266..59ce615 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -9,6 +9,7 @@ driver: run_command: /lib/systemd/systemd forward: - 9090:9090 + - 9110:9110 platforms: ## SALT `tiamat` diff --git a/prometheus/config/environ.sls b/prometheus/config/environ.sls index f5edfd8..5f8b0c9 100644 --- a/prometheus/config/environ.sls +++ b/prometheus/config/environ.sls @@ -33,7 +33,7 @@ prometheus-config-install-{{ name }}-environ_file: #- contents: | # command_args="{{ concat_args(args) }}" - context: - args: {{ args }} + args: {{ concat_args(args) }} - watch_in: - service: prometheus-service-running-{{ name }} - require: diff --git a/prometheus/defaults.yaml b/prometheus/defaults.yaml index b05c14d..023c360 100644 --- a/prometheus/defaults.yaml +++ b/prometheus/defaults.yaml @@ -44,7 +44,7 @@ prometheus: version: v0.21.0 config_file: /etc/prometheus/alertmanager.yml config: {} - environ_file: /etc/default/prometheus-alertmanager.sh + environ_file: /etc/default/prometheus-alertmanager environ: {} service: args: @@ -131,7 +131,7 @@ prometheus: - tcp/9207 node_exporter: version: v1.0.1 - environ_file: /etc/default/prometheus-node-exporter.sh + environ_file: /etc/default/prometheus-node-exporter environ: {} config_file: /etc/prometheus/node_exporter.yml config: {} @@ -170,7 +170,7 @@ prometheus: - tcp/9090 pushgateway: version: v1.3.0 - environ_file: /etc/default/prometheus-pushgateway.sh + environ_file: /etc/default/prometheus-pushgateway environ: {} config_file: /etc/prometheus/pushgateway.yml config: {} diff --git a/prometheus/files/default/environ.sh.jinja b/prometheus/files/default/environ.sh.jinja index a8e4cc4..296e406 100644 --- a/prometheus/files/default/environ.sh.jinja +++ b/prometheus/files/default/environ.sh.jinja @@ -2,8 +2,8 @@ # File managed by Salt at <{{ source }}>. # Your changes may be overwritten. ######################################################################## -# Set the command-line arguments to pass to the server. -ARGS="{%- for arg, value in args.items() %}--{{ arg }}={{ value }}{{ " " if not loop.last else "" }}{% endfor %}" +# Set the command-line arguments to pass to the server.%}" +ARGS="{{ args }}" diff --git a/test/salt/pillar/default.sls b/test/salt/pillar/default.sls index e299a61..ec9fd1d 100644 --- a/test/salt/pillar/default.sls +++ b/test/salt/pillar/default.sls @@ -20,20 +20,20 @@ prometheus: # - mysqld_exporter # - memcached_exporter # not in upstream repo, only archive - exporters: - node_exporter: - textfile_collectors_dependencies: [] - textfile_collectors: - ipmitool: - enable: false - remove: false - pkg: ipmitool - smartmon: - enable: false - remove: false - pkg: smartmontools - bash_pkg: bash - smartctl: /usr/sbin/smartctl + # exporters: + # node_exporter: + # textfile_collectors_dependencies: [] + # textfile_collectors: + # ipmitool: + # enable: false + # remove: false + # pkg: ipmitool + # smartmon: + # enable: false + # remove: false + # pkg: smartmontools + # bash_pkg: bash + # smartctl: /usr/sbin/smartctl pkg: use_upstream_repo: false # Changed to use non archive install as default (the archive includes a bespoke @@ -87,6 +87,10 @@ prometheus: - to: 'team-X+alerts@example.org' node_exporter: + environ: + args: + collector.systemd: true + web.listen-address: ":9110" service: args: collector.systemd: null