Skip to content

Commit d59932f

Browse files
authored
Merge pull request #2536 from kajinamit/vhost-show_diff
vhost: Allow customizing show_diff
2 parents 1756ce0 + 5a114d9 commit d59932f

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

manifests/vhost.pp

+13-8
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,9 @@
238238
# @param ensure
239239
# Specifies if the virtual host is present or absent.<br />
240240
#
241+
# @param show_diff
242+
# Specifies whether to set the show_diff parameter for the file resource.
243+
#
241244
# @param fallbackresource
242245
# Sets the [FallbackResource](https://httpd.apache.org/docs/current/mod/mod_dir.html#fallbackresource)
243246
# directive, which specifies an action to take for any URL that doesn't map to anything in
@@ -1836,6 +1839,7 @@
18361839
Variant[Array[String], String] $setenvifnocase = [],
18371840
Variant[Array[String], String] $block = [],
18381841
Enum['absent', 'present'] $ensure = 'present',
1842+
Boolean $show_diff = true,
18391843
Optional[String] $wsgi_application_group = undef,
18401844
Optional[Variant[String, Hash]] $wsgi_daemon_process = undef,
18411845
Optional[Hash] $wsgi_daemon_process_options = undef,
@@ -2195,14 +2199,15 @@
21952199
}
21962200

21972201
concat { "${priority_real}${filename}.conf":
2198-
ensure => $ensure,
2199-
path => "${apache::vhost_dir}/${priority_real}${filename}.conf",
2200-
owner => 'root',
2201-
group => $apache::params::root_group,
2202-
mode => $apache::file_mode,
2203-
order => 'numeric',
2204-
require => Package['httpd'],
2205-
notify => Class['apache::service'],
2202+
ensure => $ensure,
2203+
path => "${apache::vhost_dir}/${priority_real}${filename}.conf",
2204+
owner => 'root',
2205+
group => $apache::params::root_group,
2206+
mode => $apache::file_mode,
2207+
show_diff => $show_diff,
2208+
order => 'numeric',
2209+
require => Package['httpd'],
2210+
notify => Class['apache::service'],
22062211
}
22072212
# NOTE(pabelanger): This code is duplicated in ::apache::vhost::custom and
22082213
# needs to be converted into something generic.

spec/defines/vhost_spec.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,7 @@
589589
it {
590590
expect(subject).to contain_concat('30-rspec.example.com.conf').with('owner' => 'root',
591591
'mode' => '0644',
592+
'show_diff' => true,
592593
'require' => 'Package[httpd]',
593594
'notify' => 'Class[Apache::Service]')
594595
}
@@ -1527,6 +1528,7 @@
15271528
'error_log_pipe' => '/dev/null',
15281529
'docroot' => '/var/www/foo',
15291530
'ensure' => 'absent',
1531+
'show_diff' => false,
15301532
'manage_docroot' => true,
15311533
'logroot' => '/tmp/logroot',
15321534
'logroot_ensure' => 'absent'
@@ -1556,7 +1558,8 @@
15561558
}
15571559

15581560
it {
1559-
expect(subject).to contain_concat('25-rspec.example.com.conf').with('ensure' => 'absent')
1561+
expect(subject).to contain_concat('25-rspec.example.com.conf').with('ensure' => 'absent',
1562+
'show_diff' => false)
15601563
}
15611564

15621565
it { is_expected.to contain_concat__fragment('rspec.example.com-apache-header') }

0 commit comments

Comments
 (0)