feat(archive): allow command line arguments without values

* If a service.args value is define as null, only render the param (key) in the systemd unit file
This commit is contained in:
chammerton 2021-05-03 11:17:32 -04:00
parent a9e26a795d
commit 08ad2caf4c
3 changed files with 7 additions and 1 deletions

View File

@ -97,6 +97,7 @@ prometheus:
service: service:
name: prometheus-node-exporter name: prometheus-node-exporter
args: args:
collector.systemd: null
web.listen-address: ":9110" web.listen-address: ":9110"
# collector.textfile.directory: /var/tmp/node_exporter # collector.textfile.directory: /var/tmp/node_exporter

View File

@ -132,7 +132,11 @@ prometheus-archive-install-{{ name }}-managed-service:
{%- if name in ('node_exporter', 'consul_exporter') or 'config_file' not in p.pkg.component[name] %} {%- if name in ('node_exporter', 'consul_exporter') or 'config_file' not in p.pkg.component[name] %}
{%- set args = [] %} {%- set args = [] %}
{%- for param, value in p.pkg.component.get(name).get('service').get('args', {}).items() %} {%- for param, value in p.pkg.component.get(name).get('service').get('args', {}).items() %}
{%- if value is not none %}
{% do args.append("--" ~ param ~ "=" ~ value ) %} {% do args.append("--" ~ param ~ "=" ~ value ) %}
{%- else %}
{% do args.append("--" ~ param ) %}
{%- endif %}
{%- endfor %} {%- endfor %}
start: {{ p.pkg.component[name]['path'] }}/{{ name }} {{ args|join(' ') }} start: {{ p.pkg.component[name]['path'] }}/{{ name }} {{ args|join(' ') }}
{%- else %} {%- else %}

View File

@ -87,6 +87,7 @@ prometheus:
node_exporter: node_exporter:
service: service:
args: args:
collector.systemd: null
web.listen-address: ":9110" web.listen-address: ":9110"
# collector.textfile.directory: /var/tmp/node_exporter # collector.textfile.directory: /var/tmp/node_exporter