From a7fad9825103da32d1d0416939c93444504015bf Mon Sep 17 00:00:00 2001 From: Alexander Weidinger Date: Fri, 26 Apr 2019 13:09:09 +0200 Subject: [PATCH] fix(FreeBSD): elegantly prevent service hang See https://github.com/saltstack/salt/issues/44848#issuecomment-487016414 --- prometheus/service/running.sls | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/prometheus/service/running.sls b/prometheus/service/running.sls index 0f206e2..80faa5a 100644 --- a/prometheus/service/running.sls +++ b/prometheus/service/running.sls @@ -12,29 +12,16 @@ include: {%- if prometheus.service.sysrc %} prometheus_args: 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 %} -{#- 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: service.running: - name: {{ prometheus.service.name }} - enable: True - watch: -{%- endif %} - file: prometheus-config-file-file-managed {%- if prometheus.service.sysrc %} - sysrc: prometheus_args