Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Put selboolean{'zabbix_can_network'} inside ensure_resources #599

Merged
merged 2 commits into from
Apr 6, 2019
Merged

Put selboolean{'zabbix_can_network'} inside ensure_resources #599

merged 2 commits into from
Apr 6, 2019

Conversation

KrzysztofHajdamowicz
Copy link
Contributor

Pull Request (PR) description

puppet-zabbix module depends on stdlib, ensure_resources is already availble for usage.
My motivation for this change is global declaration that zabbix_can_network and zabbix server belongs to this global declaration.
ensure_resource allows for resource duplication as long as declaration of those resource is identical.
Also, notifying service dependency is useless IMO, as SELinux and ZBX are separate things and ZBX doesn't need to be restarted in order to make SELinux policies to be applied.

This Pull Request (PR) fixes the following issues

Fixes #598

puppet-zabbix module depends on stdlib, `ensure_resources` is already availble for usage.
My motivation for this change is global declaration that zabbix_can_network and zabbix server belongs to this global declaration.
ensure_resource allows for resource duplication as long as declaration of those resource is identical.
Also, notifying service dependency is useless IMO, as SELinux and ZBX are separate things and ZBX doesn't need to be restarted in order to make SELinux policies to be applied.
Missing coma caused Travis to fail some test
@bastelfreak
Copy link
Member

Hi. Can you please expain why you wrap the selboolean into ensure_resource()? The zabbix_can_network setting is pretty specific to selinux so in my opinion should be managed within this module.

@bastelfreak bastelfreak added needs-feedback Further information is requested tests-fail labels Apr 2, 2019
@KrzysztofHajdamowicz
Copy link
Contributor Author

Hi. Can you please expain why you wrap the selboolean into ensure_resource()? The zabbix_can_network setting is pretty specific to selinux so in my opinion should be managed within this module.

zabbix_can_network seboolean allows both zabbix-agent and zabbix-server to create TCP connections.
In our usecase we want do check did zbxagnt can connect to specified TCP port (service stops listening at it, despite it is still running so systemd can't complain). Such service exists on all hosts, including Zabbix Server, thus duplicate resource declaration.

ensure_resource looks like good solution, because, according to documentation

If the resource already exists, but does not match the specified parameters, this function attempts to recreate the resource, leading to a duplicate resource definition error

So puppet will run with success ONLY IF all declarations are the same. Thus, no difference if it resource is managed by puppet-zabbix or elsewhere. This resource can be only in state puppet-zabbix wants or puppet run will fail.

@KrzysztofHajdamowicz
Copy link
Contributor Author

Also, can You retrigger unit test? All failed ones are due to timeout od VM with docker.

@bastelfreak
Copy link
Member

I restarted all failed jobs.

@KrzysztofHajdamowicz
Copy link
Contributor Author

Looks like unittests are OK :)

@bastelfreak bastelfreak added enhancement New feature or request and removed needs-feedback Further information is requested tests-fail labels Apr 6, 2019
@bastelfreak bastelfreak merged commit 8da8100 into voxpupuli:master Apr 6, 2019
@KrzysztofHajdamowicz KrzysztofHajdamowicz deleted the fix/change-selmodule-to-ensure_resources branch November 6, 2019 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot declare Selboolean zabbix_can_network elsewhere
2 participants