Closed cdino closed 7 years ago
Good plan. Thanks for that.
Can you please add some tests for this parameter?
Sorry but I'm not sure what you mean:
Warning: ModuleLoader: module 'puppet' has unresolved dependencies - it will only see those that are resolved. Use 'puppet module list --tree' to see information about modules
(file & line not available)
Warning: This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Bool. There is further documentation for validate_legacy function in the README. at ["/etc/puppetlabs/code/environments/dev4/modules/puppet/manifests/init.pp", 140]:
(at /etc/puppetlabs/code/environments/dev4/modules/stdlib/lib/puppet/functions/deprecation.rb:25:in `deprecation')
Warning: This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::String. There is further documentation for validate_legacy function in the README. at ["/etc/puppetlabs/code/environments/dev4/modules/puppet/manifests/init.pp", 155]:
(at /etc/puppetlabs/code/environments/dev4/modules/stdlib/lib/puppet/functions/deprecation.rb:25:in `deprecation')
Warning: This method is deprecated, please use the stdlib validate_legacy function, with Pattern[]. There is further documentation for validate_legacy function in the README. at ["/etc/puppetlabs/code/environments/dev4/modules/puppet/manifests/init.pp", 171]:
(at /etc/puppetlabs/code/environments/dev4/modules/stdlib/lib/puppet/functions/deprecation.rb:25:in `deprecation')
Notice: Compiled catalog for pppuppet01 in environment production in 0.93 seconds
Notice: /Stage[main]/Puppet::Repo::Yum/Yumrepo[puppetlabs-products]/ensure: current_value absent, should be present (noop)
Notice: /Stage[main]/Puppet::Repo::Yum/Yumrepo[puppetlabs-products-source]/ensure: current_value absent, should be present (noop)
Notice: /Stage[main]/Puppet::Repo::Yum/Yumrepo[puppetlabs-deps]/ensure: current_value absent, should be present (noop)
Notice: /Stage[main]/Puppet::Repo::Yum/Yumrepo[puppetlabs-deps-source]/ensure: current_value absent, should be present (noop)
Notice: /Stage[main]/Puppet::Repo::Yum/Yumrepo[puppetlabs-devel]/ensure: current_value absent, should be present (noop)
Notice: /Stage[main]/Puppet::Repo::Yum/Yumrepo[puppetlabs-devel-source]/ensure: current_value absent, should be present (noop)
Notice: Class[Puppet::Repo::Yum]: Would have triggered 'refresh' from 6 events
Notice: /Stage[main]/Puppet::Config/Ini_setting[puppet client server]/ensure: current_value absent, should be present (noop)
Notice: /Stage[main]/Puppet::Config/Ini_setting[puppet ca_server]/value: current_value [redacted sensitive information], should be [redacted sensitive information] (noop)
Notice: /Stage[main]/Puppet::Config/Ini_setting[puppet ca_port]/ensure: current_value absent, should be present (noop)
Notice: /Stage[main]/Puppet::Config/Ini_setting[puppet client cfacter]/ensure: current_value absent, should be present (noop)
Notice: /Stage[main]/Puppet::Config/Ini_setting[puppet client environment]/value: current_value [redacted sensitive information], should be [redacted sensitive information] (noop)
Notice: /Stage[main]/Puppet::Config/Ini_setting[puppet client runinterval]/ensure: current_value absent, should be present (noop)
Notice: /Stage[main]/Puppet::Config/Ini_setting[puppet client show_diff]/ensure: current_value absent, should be present (noop)
Notice: /Stage[main]/Puppet::Config/Ini_setting[puppet client splay]/ensure: current_value absent, should be present (noop)
Notice: /Stage[main]/Puppet::Config/Ini_setting[puppet preferred_serialization_format]/ensure: current_value absent, should be present (noop)
Notice: /Stage[main]/Puppet::Config/Ini_setting[puppet client reports]/ensure: current_value absent, should be present (noop)
Notice: /Stage[main]/Puppet::Config/Ini_setting[puppet client structured_facts]/ensure: current_value absent, should be present (noop)
Notice: Class[Puppet::Config]: Would have triggered 'refresh' from 11 events
Notice: Class[Puppet::Agent]: Would have triggered 'refresh' from 1 events
Notice: /Stage[main]/Puppet::Agent/Service[puppet]/ensure: current_value stopped, should be running (noop)
Notice: Class[Puppet::Agent]: Would have triggered 'refresh' from 1 events
Notice: Stage[main]: Would have triggered 'refresh' from 3 events
Notice: Applied catalog in 0.42 seconds
with the following code:
class { '::puppet::profile::agent':
ca_server => 'testCA.puppet',
ca_port => '8141',
}
correct?
I use rspec and puppetlabs-spec_helper to test the code works. This file contains the tests for each of the resources for the puppet::config class. https://github.com/abstractitptyltd/abstractit-puppet/blob/production/spec/classes/puppet_master_config_spec.rb
It's pretty logical. You just need to add a new section to test your new parameter. Travis-CI will run those tests whenever you push up new code into your branch.
I saw Travis-CI checks and are passed.
I also added a section on spec/classes/puppet_config_spec.rb
and pulled to my current branch.
puppet::config
When on an centos-7-x86_64 system
should compile into a catalogue without dependency cycles
when fed no parameters
should properly set the puppet server setting in /etc/puppetlabs/puppet/puppet.conf
should properly set the puppet srv records settings in /etc/puppetlabs/puppet/puppet.conf
should properly set the environment setting in /etc/puppetlabs/puppet/puppet.conf
should set the puppet agent runinterval properly in /etc/puppetlabs/puppet/puppet.conf
should set the puppet agent show_diff parameter in /etc/puppetlabs/puppet/puppet.conf
should set the puppet agent splay parameter in /etc/puppetlabs/puppet/puppet.conf
should setup puppet.conf to support structured_facts in /etc/puppetlabs/puppet/puppet.conf
should properly set the cfacter setting in /etc/puppetlabs/puppet/puppet.conf
should properly set the preferred_serialization_format setting in /etc/puppetlabs/puppet/puppet.conf
when ::puppet::ca_server is set
should set ca_server to bogon.domain.com
when ::puppet::ca_server is not set
should unset ca_server
when ::puppet::ca_port is set
should set ca_port to 8141
when ::puppet::ca_port is not set
should unset ca_port
when ::puppet::cfacter is true
should properly set the cfacter setting in /etc/puppetlabs/puppet/puppet.conf
when ::puppet::logdest is true
should properly set the logdest setting in /etc/sysconfig/puppet
when ::puppet::preferred_serialization_format is set to msgpack
should properly set the preferred_serialization_format setting in /etc/puppetlabs/puppet/puppet.conf
when ::puppet::puppet_server has a non-standard value
should properly set the server setting in /etc/puppetlabs/puppet/puppet.conf
when ::puppet::environment has a non-standard value
should properly set the environment setting in /etc/puppetlabs/puppet/puppet.conf
when ::puppet::runinterval has a non-standard value
should properly set the runinterval setting in /etc/puppetlabs/puppet/puppet.conf
when ::puppet::show_diff is true
should properly set the show_diff setting in /etc/puppetlabs/puppet/puppet.conf
when ::puppet::splay is true
should properly set the splay setting in /etc/puppetlabs/puppet/puppet.conf
when ::puppet::splaylimit has a non-standard value
should properly set the splaylimit setting in /etc/puppetlabs/puppet/puppet.conf
when ::puppet::structured_facts is false
should properly set the stringify_facts setting in puppet.conf
when ::puppet::reports is false
should properly set the reports setting in /etc/puppetlabs/puppet/puppet.conf
when $::puppet::use_srv_records is true and srv_domain is foo.com
should set use_srv_records and srv_domain in puppet.conf
when $::puppet::pluginsource is set
should set pluginsource in puppet.conf
when $::puppet::pluginsource is not set
should unset pluginsource in puppet.conf
when $::puppet::pluginfactsource is set
should set pluginsource in puppet.conf
when $::puppet::pluginfactsource is undef
should unset pluginsource in puppet.conf
My parameter looks like working:
when ::puppet::ca_port is set
should set ca_port to 8141
Correct?
Awesome. Thanks for that.
I will push out another release soon.
I added and tested the missing config parameter
ca_port
following your way :)