fix(FreeBSD): elegantly prevent service hang
See https://github.com/saltstack/salt/issues/44848#issuecomment-487016414
This commit is contained in:
parent
1344636b70
commit
a7fad98251
@ -12,29 +12,16 @@ include:
|
|||||||
{%- if prometheus.service.sysrc %}
|
{%- if prometheus.service.sysrc %}
|
||||||
prometheus_args:
|
prometheus_args:
|
||||||
sysrc.managed:
|
sysrc.managed:
|
||||||
- value: {{ prometheus.service.flags }}
|
# service prometheus restart tended to hang on FreeBSD
|
||||||
|
# https://github.com/saltstack/salt/issues/44848#issuecomment-487016414
|
||||||
|
- value: "{{ prometheus.service.flags }} >/dev/null 2>&1"
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
{#- On FreeBSD restarting this service hangs. #}
|
|
||||||
{#- See https://github.com/saltstack/salt/issues/44848#issuecomment-486460601 #}
|
|
||||||
{%- if salt['grains.get']('os_family') == 'FreeBSD' %}
|
|
||||||
prometheus-service-running-service-enable:
|
|
||||||
service.enabled:
|
|
||||||
- name: {{ prometheus.service.name }}
|
|
||||||
|
|
||||||
prometheus-service-running-service-running:
|
|
||||||
cmd.run:
|
|
||||||
- name: "service {{ prometheus.service.name }} onerestart >/dev/null 2>&1"
|
|
||||||
- hide_output: True
|
|
||||||
- timeout: 60
|
|
||||||
- onchanges:
|
|
||||||
{%- else %}{# business as usual #}
|
|
||||||
prometheus-service-running-service-running:
|
prometheus-service-running-service-running:
|
||||||
service.running:
|
service.running:
|
||||||
- name: {{ prometheus.service.name }}
|
- name: {{ prometheus.service.name }}
|
||||||
- enable: True
|
- enable: True
|
||||||
- watch:
|
- watch:
|
||||||
{%- endif %}
|
|
||||||
- file: prometheus-config-file-file-managed
|
- file: prometheus-config-file-file-managed
|
||||||
{%- if prometheus.service.sysrc %}
|
{%- if prometheus.service.sysrc %}
|
||||||
- sysrc: prometheus_args
|
- sysrc: prometheus_args
|
||||||
|
Loading…
Reference in New Issue
Block a user