Skip to content

Commit 2dc32cc

Browse files
committed
(maint) Corrective changes
- Fixes made to spec tests - onlyif commands corrected - remove unnecessary shell_escapes - variable used in place of replicated assignment - $_file_path neatened
1 parent 4190789 commit 2dc32cc

File tree

5 files changed

+14
-13
lines changed

5 files changed

+14
-13
lines changed

manifests/custom_config.pp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,12 @@
9090
$notifies = undef
9191
}
9292

93+
$_file_path = "${confdir}/${_filename}"
9394
$_file_mode = pick($file_mode, $apache::file_mode)
9495

9596
file { "apache_${name}":
9697
ensure => $ensure,
97-
path => "${confdir}/${_filename}",
98+
path => $_file_path,
9899
owner => $owner,
99100
group => $group,
100101
mode => $_file_mode,
@@ -115,7 +116,7 @@
115116
require => Anchor['::apache::modules_set_up'],
116117
}
117118

118-
$remove_command = ['/bin/rm', shell_escape(join([$confdir, $_filename], '/'))]
119+
$remove_command = ['/bin/rm', $_file_path]
119120
exec { "remove ${name} if invalid":
120121
command => $remove_command,
121122
unless => [$verify_command],

manifests/mpm/disable_mpm_event.pp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
# @summary disable Apache-Module event
22
class apache::mpm::disable_mpm_event {
33
$event_command = ['/usr/sbin/a2dismod', 'event']
4-
$event_onlyif = ['/usr/bin/test', '-e', shell_escape(join([$apache::mod_enable_dir, 'event.load'],'/'))]
4+
$event_onlyif = [['/usr/bin/test', '-e', join([$apache::mod_enable_dir, 'event.load'],'/')]]
55
exec { '/usr/sbin/a2dismod event':
66
command => $event_command,
77
onlyif => $event_onlyif,
88
require => Package['httpd'],
99
before => Class['apache::service'],
1010
}
1111

12-
$event_load_command = ['/bin/rm', shell_escape(join([$apache::mod_enable_dir, 'event_event.load'],'/'))]
13-
$event_load_onlyif = ['/usr/bin/test', '-e', shell_escape(join([$apache::mod_enable_dir, 'event_event.load'],'/'))]
12+
$event_load_command = ['/bin/rm', join([$apache::mod_enable_dir, 'event_event.load'],'/')]
13+
$event_load_onlyif = [['/usr/bin/test', '-e', join([$apache::mod_enable_dir, 'event_event.load'],'/')]]
1414
exec { 'remove distribution event load file':
1515
command => $event_load_command,
1616
onlyif => $event_load_onlyif,
1717
require => Package['httpd'],
1818
before => Class['apache::service'],
1919
}
2020

21-
$event_conf_command = ['/bin/rm', shell_escape(join([$apache::mod_enable_dir, 'event_event.conf'],'/'))]
22-
$event_conf_onlyif = ['/usr/bin/test', '-e', shell_escape(join([$apache::mod_enable_dir, 'event_event.conf'],'/'))]
21+
$event_conf_command = ['/bin/rm', join([$apache::mod_enable_dir, 'event_event.conf'],'/')]
22+
$event_conf_onlyif = [['/usr/bin/test', '-e', join([$apache::mod_enable_dir, 'event_event.conf'],'/')]]
2323
exec { 'remove distribution event conf file':
2424
command => $event_conf_command,
2525
onlyif => $event_conf_onlyif,

manifests/mpm/disable_mpm_prefork.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# @summary disable Apache-Module prefork
22
class apache::mpm::disable_mpm_prefork {
33
$prefork_command = ['/usr/sbin/a2dismod', 'prefork']
4-
$prefork_onlyif = ['/usr/bin/test', '-e', shell_escape(join([$apache::mod_enable_dir, 'prefork.load'],'/'))]
4+
$prefork_onlyif = [['/usr/bin/test', '-e', join([$apache::mod_enable_dir, 'prefork.load'],'/')]]
55
exec { '/usr/sbin/a2dismod prefork':
66
command => $prefork_command,
77
onlyif => $prefork_onlyif,

manifests/mpm/disable_mpm_worker.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# @summary disable Apache-Module worker
22
class apache::mpm::disable_mpm_worker {
33
$worker_command = ['/usr/sbin/a2dismod', 'worker']
4-
$worker_onlyif = ['/usr/bin/test', '-e', shell_escape(join([$apache::mod_enable_dir, 'worker.load'],'/'))]
4+
$worker_onlyif = [['/usr/bin/test', '-e', join([$apache::mod_enable_dir, 'worker.load'],'/')]]
55
exec { '/usr/sbin/a2dismod worker':
66
command => $worker_command,
77
onlyif => $worker_onlyif,

spec/defines/custom_config_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121

2222
it {
2323
is_expected.to contain_exec('syntax verification for rspec')
24-
.with('refreshonly' => 'true', 'command' => '/usr/sbin/apachectl -t')
24+
.with('refreshonly' => 'true', 'command' => ['/usr/sbin/apachectl -t'])
2525
.that_subscribes_to('File[apache_rspec]')
2626
.that_notifies('Class[Apache::Service]')
2727
.that_comes_before('Exec[remove rspec if invalid]')
2828
}
2929
it {
3030
is_expected.to contain_exec('remove rspec if invalid')
31-
.with('unless' => '/usr/sbin/apachectl -t', 'refreshonly' => 'true')
31+
.with('unless' => ['/usr/sbin/apachectl -t'], 'refreshonly' => 'true')
3232
.that_subscribes_to('File[apache_rspec]')
3333
}
3434
it {
@@ -51,8 +51,8 @@
5151
is_expected.to contain_exec('syntax verification for rspec').with('command' => '/bin/true')
5252
}
5353
it {
54-
is_expected.to contain_exec('remove rspec if invalid').with('command' => '/bin/rm /dne/30-rspec.conf',
55-
'unless' => '/bin/true')
54+
is_expected.to contain_exec('remove rspec if invalid').with('command' => ['/bin/rm', '/dne/30-rspec.conf'],
55+
'unless' => ['/bin/true'])
5656
}
5757
it {
5858
is_expected.to contain_file('apache_rspec')

0 commit comments

Comments
 (0)