Zabbix services should restart if pkg changes#127
Open
xenadmin wants to merge 3 commits intosaltstack-formulas:masterfrom
Open
Zabbix services should restart if pkg changes#127xenadmin wants to merge 3 commits intosaltstack-formulas:masterfrom
xenadmin wants to merge 3 commits intosaltstack-formulas:masterfrom
Conversation
Contributor
Author
|
@hatifnatt: @myii pinged me, if I'm available for lifting the formula to 5.0. That reminded me of this open PR and I wanted to ask you for your opinion? That would help me catch up with my fork, so I could come back for improving. |
Contributor
|
@hatifnatt I've been discussing some stuff about the formula with @xenadmin and we realised that this PR was still outstanding. Would you mind having a look and merging if all is OK? It's a relatively small change, so should be easy enough to review. |
Contributor
|
Whoops, both at the same time! |
Collaborator
|
It's a good change for sure, but I can suggest to use it to preform restart after package changes too, like this: zabbix-agent:
pkg.installed:
- pkgs:
{%- for name in zabbix.agent.pkgs %}
- {{ name }}{% if zabbix.agent.version is defined and 'zabbix' in name %}: '{{ zabbix.agent.version }}'{% endif %}
{%- endfor %}
{% if salt['grains.get']('os') != 'Windows' %}
- require_in:
- user: zabbix-formula_zabbix_user
- group: zabbix-formula_zabbix_group
{% endif %}
- watch_in:
- module: zabbix-agent-restart
service.running:
- name: {{ zabbix.agent.service }}
- enable: True
- require:
- pkg: zabbix-agent
- file: zabbix-agent-logdir
{% if salt['grains.get']('os') != 'Windows' %}
- file: zabbix-agent-piddir
{% endif %}
zabbix-agent-restart:
module.wait:
- name: service.restart
- m_name: {{ zabbix.agent.service }}Things to notice: zabbix-agent:
pkg.installed:
...
- watch_in:
- module: zabbix-agent-restartinstead of zabbix-agent:
service.running:
...
- watch:
- pkg: zabbix-agent |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I started playing around with forced version updates, and noticed that even if the packages install successfully, the service doesn't notice it. This PR could fix that.
Example:
/srv/pillar/zabbix/init.sls