-
-
Notifications
You must be signed in to change notification settings - Fork 230
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
Add ability to stop the agent #562
Add ability to stop the agent #562
Conversation
E.g. to preconfigure a hosts agent and turn on the service at a later time (when the server reaches production SLA)
manifests/agent.pp
Outdated
@@ -228,6 +237,8 @@ | |||
$listenip = $zabbix::params::agent_listenip, | |||
$startagents = $zabbix::params::agent_startagents, | |||
$serveractive = $zabbix::params::agent_serveractive, | |||
Enum['running','stopped'] $service_state = $zabbix::params::agent_service_state, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you instead use the stdlib datatype for this:
https://github.com/puppetlabs/puppetlabs-stdlib/blob/master/types/ensure/service.pp#L1
Hi @mkilchhofer, thanks for the contribution! Did you already check https://github.com/voxpupuli/puppet-zabbix/blob/master/spec/classes/agent_spec.rb? That is the file with all the related rspec-puppet tests for the agent. If you've any questions I suggest you join our slack channel at https://slack.puppet.com or our IRC channel #voxppuli on freenode. That would make it way easier to discuss proper testing and an rspec walkthrough. |
manifests/params.pp
Outdated
@@ -239,6 +239,8 @@ | |||
$agent_refreshactivechecks = '120' | |||
$agent_server = '127.0.0.1' | |||
$agent_serveractive = undef | |||
$agent_service_ensure = 'running' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you fix the =
alignment here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup :)
I will have a look into rspec tests in the next week. I had my problems to run them on the rhel machines at work (ruby2.0). But on my fedora laptop (ruby2.5+), your mentioned spec file works fine. |
We don't support ruby2.0 and 2.1 anymore. Both are EOL since ages. Ruby2.2 and newer should work. |
Is something like this enough:
|
@mkilchhofer yes the test looks fine. I restarted the failed travis job. |
Pull Request (PR) description
For our "IoT use case" we want to completely configure a mini server during the staging process. When a technician installs the device to its final position (in a vehicle), we want to activate the monitoring agent.
This PR adds the ability to start/stop the agent and to enable/disable the agents automatic startup during boot.
--> Could someone help me writing my first rspec tests for this feature?