Skip to content

Commit

Permalink
fix(systemd): fix service detection
Browse files Browse the repository at this point in the history
Fix service detection to properly ensure the service is running.
Command also updated at other service.running/dead onlyif.
  • Loading branch information
Adrien "ze" Urban committed Jul 7, 2022
1 parent 4eb3804 commit 96b02bc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mongodb/service/clean.sls
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ include:
service.dead:
- name: {{ servicename }}
{% if grains.kernel|lower == 'linux' %}
- onlyif: systemctl list-units |grep {{ servicename }} >/dev/null 2>&1
- onlyif: systemctl list-unit-files |grep {{ servicename }} >/dev/null 2>&1
{%- endif %} {# linux #}
- enable: False
{%- endif %}
Expand Down
6 changes: 3 additions & 3 deletions mongodb/service/running.sls
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ include:
- reload_modules: true
service.running:
- name: firewalld
- onlyif: systemctl list-units | grep firewalld >/dev/null 2>&1
- onlyif: systemctl list-unit-files | grep firewalld >/dev/null 2>&1
- enable: True
{%- endif %}
{%- endif %}
Expand Down Expand Up @@ -236,7 +236,7 @@ include:
- name: {{ servicename }}
- onlyif:
- {{ grains.kernel|lower == 'linux' }}
- systemctl list-units | grep {{ servicename }} >/dev/null 2>&1
- systemctl list-unit-files | grep {{ servicename }} >/dev/null 2>&1
- require:
- sls: {{ sls_software_install }}
- sls: {{ sls_config_users }}
Expand All @@ -253,7 +253,7 @@ include:
service.running:
- name: {{ servicename }}
- enable: True
- onlyif: systemctl list-units | grep {{ servicename }} >/dev/null 2>&1
- onlyif: systemctl list-unit-files | grep {{ servicename }} >/dev/null 2>&1
{%- endif %}
- require:
- sls: {{ sls_software_install }}
Expand Down

0 comments on commit 96b02bc

Please sign in to comment.