Skip to content

Commit

Permalink
Merge branch 'production' into feature/expanded_custom_facts
Browse files Browse the repository at this point in the history
  • Loading branch information
MemberIT committed May 17, 2017
2 parents 773b037 + 2cd69bc commit 4dc42d2
Show file tree
Hide file tree
Showing 12 changed files with 96 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ matrix:
env: PUPPET_GEM_VERSION="~> 4.8.0" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 3.2.0"
- rvm: 2.1.9
env: PUPPET_GEM_VERSION="~> 4.9.0" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 3.3.0"
- rvm: 2.1.9
env: PUPPET_GEM_VERSION="~> 4.10.1" FACTER_GEM_VERSION="~> 2.4" HIERA_GEM_VERSION="~> 3.3.0"

deploy:
provider: puppetforge
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,10 @@ The `puppet` class is responsible for validating some of our parameters, and ins

Sets the runinterval in `puppet.conf`

* **show_diff**: (*bool* Default: `false`)

Whether to log and report a contextual diff when files are being replaced.

* **splay**: (*bool* Default `false`)

Sets the splay parameter in puppet.conf
Expand Down
21 changes: 20 additions & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
$puppet_server = $::puppet::puppet_server
$reports = $::puppet::reports
$runinterval = $::puppet::runinterval
$show_diff = $::puppet::show_diff
$splay = $::puppet::splay
$splaylimit = $::puppet::splaylimit
$structured_facts = $::puppet::structured_facts
Expand Down Expand Up @@ -66,10 +67,19 @@
$_ensure_pluginfactsource = 'absent'
}

ini_setting { 'puppet client server agent':
ensure => absent,
path => "${confdir}/puppet.conf",
section => 'agent',
setting => 'server',
value => $puppet_server,
require => Class['puppet::install'],
}

ini_setting { 'puppet client server':
ensure => $_ensure_puppet_server,
path => "${confdir}/puppet.conf",
section => 'agent',
section => 'main',
setting => 'server',
value => $puppet_server,
require => Class['puppet::install'],
Expand Down Expand Up @@ -143,6 +153,15 @@
require => Class['puppet::install'],
}

ini_setting { 'puppet client show_diff':
ensure => present,
path => "${confdir}/puppet.conf",
section => 'agent',
setting => 'show_diff',
value => $show_diff,
require => Class['puppet::install'],
}

ini_setting { 'puppet client splay':
ensure => present,
path => "${confdir}/puppet.conf",
Expand Down
4 changes: 4 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
# Whether or not to send reports
# @param runinterval [String] Default: '30m'
# Sets the runinterval in puppet.conf
# @param show_diff [Boolean] Default: false
# Sets the show_diff parameter in puppet.conf
# @param splay [Boolean] Default: false
# Sets the splay parameter in puppet.conf
# @param splaylimit [String] Default: undef
Expand Down Expand Up @@ -122,6 +124,7 @@
$puppet_version = 'installed',
$reports = true,
$runinterval = '30m',
$show_diff = false,
$splay = false,
$splaylimit = undef,
$structured_facts = false,
Expand All @@ -141,6 +144,7 @@
$manage_etc_facter_facts_d,
$manage_repos,
$reports,
$show_diff,
$splay,
$structured_facts,
)
Expand Down
3 changes: 2 additions & 1 deletion manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

package { $agent_package:
ensure => $package_ensure,
require => Class['::puppet::install::deps']
require => Class['::puppet::install::deps'],
notify => Class['::puppet::agent'],
}

}
4 changes: 4 additions & 0 deletions manifests/profile/agent.pp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
# Whether or not to send reports
# @param runinterval [String] Default: '30m'
# Sets the runinterval in puppet.conf
# @param show_diff [Boolean] Default: false
# Sets the show_diff parameter in puppet.conf
# @param splay [Boolean] Default: false
# Sets the splay parameter in puppet.conf
# @param splaylimit [String] Default: undef
Expand Down Expand Up @@ -101,6 +103,7 @@
$puppet_version = 'installed',
$reports = true,
$runinterval = '30m',
$show_diff = false,
$splay = false,
$splaylimit = undef,
$structured_facts = false,
Expand Down Expand Up @@ -131,6 +134,7 @@
puppet_version => $puppet_version,
reports => $reports,
runinterval => $runinterval,
show_diff => $show_diff,
splay => $splay,
splaylimit => $splaylimit,
structured_facts => $structured_facts,
Expand Down
7 changes: 7 additions & 0 deletions manifests/profile/puppetdb.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
#
# @param puppetdb_version [String] Default: 'installed'
# The version of puppetdb to install.
# @param puppetdb_manage_dbserver [Boolean] Default: true
# Whether to tell PuppetDB to also manage the Postgresql server.
# Set this to false if you are independently configuring a
# Postgresql server, e.g., because you are using it for other
# databases in addition to pupept.
# @param node_purge_ttl [String] Default: 0s
# The length of time a node can be deactivated before it's deleted from the database. (a value of '0' disables purging).
# @param node_ttl [String] Default: '0s'
Expand All @@ -33,6 +38,7 @@
$node_ttl = '0s',
$puppetdb_listen_address = '127.0.0.1',
$puppetdb_server = undef,
$puppetdb_manage_dbserver = true,
$puppetdb_ssl_listen_address = '0.0.0.0',
$report_ttl = '14d',
$reports = undef,
Expand Down Expand Up @@ -106,6 +112,7 @@
disable_ssl => $disable_ssl,
listen_address => $puppetdb_listen_address,
ssl_listen_address => $puppetdb_ssl_listen_address,
manage_dbserver => $puppetdb_manage_dbserver,
node_ttl => $node_ttl,
node_purge_ttl => $node_purge_ttl,
report_ttl => $report_ttl,
Expand Down
12 changes: 12 additions & 0 deletions manifests/profile/r10k.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# @param cachedir [String] Default: undef
# @param configfile [String] Default: undef
# @param version [String] Default: undef
# @param puppet_master [String] Default: undef
# @param modulepath [String] Default: undef
# @param manage_modulepath [String] Default: undef
# @param manage_ruby_dependency [String] Default: 'ignore'
Expand All @@ -21,6 +22,9 @@
# @param configfile_symlink [String] Default: undef
# @param include_prerun_command [Boolean] Default: false
# @param include_postrun_command [Boolean] Default: false
# @param git_settings [String] Default: undef
# @param forge_settings [String] Default: undef
# @param postrun [String] Default: undef
# @param env_owner [String] Default:'root',
# @param r10k_minutes [Array] Default [0,15,30,45]
# @param r10k_update [Boolean] true
Expand All @@ -32,6 +36,7 @@
$cachedir = undef,
$configfile = undef,
$version = undef,
$puppet_master = undef,
$modulepath = undef,
$manage_modulepath = undef,
$manage_ruby_dependency = 'ignore',
Expand All @@ -45,6 +50,9 @@
$configfile_symlink = undef,
$include_prerun_command = false,
$include_postrun_command = false,
$git_settings = undef,
$forge_settings = undef,
$postrun = undef,
$env_owner = 'root',
$r10k_minutes = [
0,
Expand Down Expand Up @@ -82,6 +90,7 @@
cachedir => $cachedir,
configfile => $configfile,
version => $version,
puppet_master => $puppet_master,
modulepath => $modulepath,
manage_modulepath => $manage_modulepath,
manage_ruby_dependency => $manage_ruby_dependency,
Expand All @@ -95,6 +104,9 @@
configfile_symlink => $configfile_symlink,
include_prerun_command => $include_prerun_command,
include_postrun_command => $include_postrun_command,
git_settings => $git_settings,
forge_settings => $forge_settings,
postrun => $postrun,
}

# cron for updating the r10k environment
Expand Down
41 changes: 38 additions & 3 deletions spec/classes/puppet_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,22 @@
end
context 'when fed no parameters' do
it "should properly set the puppet server setting in #{confdir}/puppet.conf" do
should contain_ini_setting('puppet client server agent').with({
'ensure'=>'absent',
'path'=>"#{confdir}/puppet.conf",
'section'=>'agent',
'setting'=>'server',
'value'=>'puppet'
})
should contain_ini_setting('puppet client server').with({
'ensure'=>'present',
'path'=>"#{confdir}/puppet.conf",
'section'=>'agent',
'section'=>'main',
'setting'=>'server',
'value'=>'puppet'
})
end
it "should properly set the puppet srv records settings in #{confdir}/puppet.conf" do
should contain_ini_setting('puppet use_srv_records').with({
'ensure'=>'absent',
'path'=>"#{confdir}/puppet.conf",
Expand Down Expand Up @@ -82,6 +91,15 @@
'value'=>'30m'
})
end
it "should set the puppet agent show_diff parameter in #{confdir}/puppet.conf" do
should contain_ini_setting('puppet client show_diff').with({
'ensure'=>'present',
'path'=>"#{confdir}/puppet.conf",
'section'=>'agent',
'setting'=>'show_diff',
'value'=>false
})
end
it "should set the puppet agent splay parameter in #{confdir}/puppet.conf" do
should contain_ini_setting('puppet client splay').with({
'ensure'=>'present',
Expand Down Expand Up @@ -187,12 +205,18 @@
context 'when ::puppet::puppet_server has a non-standard value' do
let(:pre_condition){"class{'::puppet': puppet_server => 'BOGON'}"}
it "should properly set the server setting in #{confdir}/puppet.conf" do
should contain_ini_setting('puppet client server').with({
should_not contain_ini_setting('puppet client server').with({
'path'=>"#{confdir}/puppet.conf",
'section'=>'agent',
'setting'=>'server',
'value'=>'BOGON'
})
should contain_ini_setting('puppet client server').with({
'path'=>"#{confdir}/puppet.conf",
'section'=>'main',
'setting'=>'server',
'value'=>'BOGON'
})
end
end# custom server
context 'when ::puppet::environment has a non-standard value' do
Expand All @@ -217,6 +241,17 @@
})
end
end# custom runinterval
context 'when ::puppet::show_diff is true' do
let(:pre_condition) {"class{'::puppet': show_diff => true}"}
it "should properly set the show_diff setting in #{confdir}/puppet.conf" do
should contain_ini_setting('puppet client show_diff').with({
'path'=>"#{confdir}/puppet.conf",
'section'=>'agent',
'setting'=>'show_diff',
'value'=>true
})
end
end# custom show_diff
context 'when ::puppet::splay is true' do
let(:pre_condition) {"class{'::puppet': splay => true}"}
it "should properly set the splay setting in #{confdir}/puppet.conf" do
Expand Down Expand Up @@ -283,7 +318,7 @@
should contain_ini_setting('puppet client server').with({
'ensure' => 'absent',
'path'=>"#{confdir}/puppet.conf",
'section'=>'agent',
'section'=>'main',
'setting'=>'server',
})
end
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/puppet_install_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
it 'should install puppet' do
contain_package('puppet').with({
:ensure=>"BOGON",
}).that_requires("Class['::puppet::install::deps]")
}).that_requires("Class['::puppet::install::deps]").that_notifies('class[Puppet::Agent]')
end
end# allinone false
end
Expand Down
1 change: 1 addition & 0 deletions spec/classes/puppet_profile_puppetdb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
:disable_ssl => false,
:listen_address => '127.0.0.1',
:ssl_listen_address => '0.0.0.0',
:manage_dbserver => true,
:node_ttl => '0s',
:node_purge_ttl => '0s',
:report_ttl => '14d',
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/puppet_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
end
end#arrays

['allinone','cfacter','enable_devel_repo','enabled','enable_repo','manage_etc_facter','manage_etc_facter_facts_d','manage_repos','reports','splay','structured_facts'].each do |bools|
['allinone','cfacter','enable_devel_repo','enabled','enable_repo','manage_etc_facter','manage_etc_facter_facts_d','manage_repos','reports','show_diff','splay','structured_facts'].each do |bools|
context "when the #{bools} parameter is not an boolean" do
let(:params) {{bools => "BOGON"}}
it 'should fail' do
Expand Down

0 comments on commit 4dc42d2

Please sign in to comment.