Skip to content

Commit 5d292f1

Browse files
authored
Merge pull request #898 from bastelfreak/puppet5
fix unreferenced variables; add puppet5/6 support
2 parents eb03118 + 65363b6 commit 5d292f1

6 files changed

Lines changed: 30 additions & 11 deletions

File tree

manifests/cli.pp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
path => ['/bin', '/usr/bin'],
4141
cwd => '/tmp',
4242
refreshonly => true,
43-
require => Class['::jenkins::service'],
4443
}
4544
# Extract latest CLI in case package is updated / downgraded
4645
Package[$::jenkins::package_name] ~> Exec['jenkins-cli']

manifests/job/present.pp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
file { $tmp_config_path:
5959
content => $d,
6060
require => Exec['jenkins-cli'],
61+
before => Exec["jenkins create-job ${jobname}"],
6162
}
6263
}
6364

@@ -81,7 +82,6 @@
8182
exec { "jenkins create-job ${jobname}":
8283
command => "${cat_config} | ${create_job}",
8384
creates => [$config_path, "${job_dir}/builds"],
84-
require => File[$tmp_config_path],
8585
}
8686

8787
if $replace {
@@ -91,7 +91,6 @@
9191
command => "${cat_config} | ${update_job}",
9292
onlyif => "test -e ${config_path}",
9393
unless => "${difftool} ${config_path} ${tmp_config_path}",
94-
require => File[$tmp_config_path],
9594
notify => Exec['reload-jenkins'],
9695
}
9796
}

manifests/plugin.pp

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,20 @@
3535
Any $create_user = undef,
3636
) {
3737

38+
include jenkins
39+
40+
if $jenkins::manage_service {
41+
$notify = Class['jenkins::service']
42+
} else {
43+
$notify = undef
44+
}
45+
46+
if $jenkins::manage_datadirs {
47+
$plugindir = File[$jenkins::plugin_dir]
48+
} else {
49+
$plugindir = undef
50+
}
51+
3852
if $timeout {
3953
warning('jenkins::plugin::timeout presently has effect')
4054
}
@@ -138,7 +152,7 @@
138152
group => $::jenkins::group,
139153
mode => '0644',
140154
require => Archive[$plugin],
141-
notify => Class['::jenkins::service'],
155+
notify => $notify,
142156
}
143157

144158
$pinned_ensure = $pin ? {
@@ -151,7 +165,7 @@
151165
owner => $::jenkins::user,
152166
group => $::jenkins::group,
153167
require => Archive[$plugin],
154-
notify => Class['::jenkins::service'],
168+
notify => $notify,
155169
}
156170

157171
if $digest_string {
@@ -176,8 +190,8 @@
176190
proxy_server => $::jenkins::proxy::url,
177191
cleanup => false,
178192
extract => false,
179-
require => File[$::jenkins::plugin_dir],
180-
notify => Class['::jenkins::service'],
193+
require => $plugindir,
194+
notify => $notify,
181195
}
182196
$archive_require = Archive[$plugin]
183197
} else {
@@ -189,7 +203,7 @@
189203
group => $::jenkins::group,
190204
mode => '0644',
191205
require => $archive_require,
192-
before => Class['::jenkins::service'],
206+
before => $notify,
193207
}
194208

195209
if $manage_config {

manifests/sysconfig.pp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@
88
warning("Jenkins::Sysconfig[${name}]: detected \'\$\' in value -- be advised the variable interpolation will not work under systemd")
99
}
1010

11+
if $jenkins::manage_service {
12+
$notify = Class['::jenkins::service']
13+
} else {
14+
$notify = undef
15+
}
1116
file_line { "Jenkins sysconfig setting ${name}":
1217
path => "${::jenkins::sysconfdir}/jenkins",
1318
line => "${name}=\"${value}\"",
1419
match => "^${name}=",
15-
notify => Class['::jenkins::service'],
20+
notify => $notify,
1621
}
17-
1822
}

spec/classes/jenkins_master_spec.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
end
1212

1313
let(:params) { { version: '1.2.3' } }
14+
let :pre_condition do
15+
'include jenkins'
16+
end
1417

1518
it { is_expected.to contain_jenkins__plugin('swarm').with_version('1.2.3') }
1619
end

spec/defines/jenkins_job_present_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
let(:config_file) { File.expand_path(File.dirname(__FILE__) + '/../fixtures/testjob.xml') }
3434
let(:params) { { config_file: config_file } }
3535

36-
it { is_expected.to contain_exec('jenkins create-job myjob').with_require('File[' + config_file + ']') }
36+
it { is_expected.to contain_exec('jenkins create-job myjob') }
3737
it { is_expected.to contain_exec('jenkins update-job myjob') }
3838
it { is_expected.not_to contain_exec('jenkins delete-job myjob') }
3939
end

0 commit comments

Comments
 (0)