Skip to content

Commit 99b4488

Browse files
authored
Merge pull request #2449 from puppetlabs/CAT-1348_erb_to_epp_conversion_except_in_mod_vhost_directory
(CAT-1348)-Conversion of erb to epp templates except mod or vhost dir…
2 parents e22e3c6 + 3339242 commit 99b4488

File tree

17 files changed

+254
-172
lines changed

17 files changed

+254
-172
lines changed

manifests/confd/no_accf.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
file { 'no-accf.conf':
88
ensure => 'file',
99
path => "${apache::confd_dir}/no-accf.conf",
10-
content => template('apache/confd/no-accf.conf.erb'),
10+
content => epp('apache/confd/no-accf.conf.epp'),
1111
require => Exec["mkdir ${apache::confd_dir}"],
1212
before => File[$apache::confd_dir],
1313
}

manifests/fastcgi/server.pp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,24 @@
4848
$socket = $host
4949
}
5050

51+
$parameters = {
52+
'timeout' => $timeout,
53+
'flush' => $flush,
54+
'socket' => $socket,
55+
'host' => $host,
56+
'pass_header' => $pass_header,
57+
'faux_path' => $faux_path,
58+
'fcgi_alias' => $fcgi_alias,
59+
'file_type' => $file_type,
60+
}
61+
5162
file { "fastcgi-pool-${name}.conf":
5263
ensure => file,
5364
path => "${apache::confd_dir}/fastcgi-pool-${name}.conf",
5465
owner => 'root',
5566
group => $apache::params::root_group,
5667
mode => $apache::file_mode,
57-
content => template('apache/fastcgi/server.erb'),
68+
content => epp('apache/fastcgi/server.epp', $parameters),
5869
require => Exec["mkdir ${apache::confd_dir}"],
5970
before => File[$apache::confd_dir],
6071
notify => Class['apache::service'],

manifests/init.pp

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@
727727
}
728728
concat::fragment { 'Apache ports header':
729729
target => $ports_file,
730-
content => template('apache/ports_header.erb'),
730+
content => epp('apache/ports_header.epp'),
731731
}
732732

733733
if $apache::conf_dir and $apache::params::conf_file {
@@ -782,10 +782,57 @@
782782
# - $server_signature
783783
# - $trace_enable
784784
# - $root_directory_secured
785+
$parameters = {
786+
'server_tokens' => $server_tokens,
787+
'server_signature' => $server_signature,
788+
'trace_enable' => $trace_enable,
789+
'servername' => $servername,
790+
'server_root' => $server_root,
791+
'serveradmin' => $serveradmin,
792+
'pidfile' => $pidfile,
793+
'timeout' => $timeout,
794+
'keepalive' => $keepalive,
795+
'max_keepalive_requests' => $max_keepalive_requests,
796+
'keepalive_timeout' => $keepalive_timeout,
797+
'limitreqfieldsize' => $limitreqfieldsize,
798+
'limitreqfields' => $limitreqfields,
799+
'limitreqline' => $limitreqline,
800+
'http_protocol_options' => $http_protocol_options,
801+
'protocols' => $protocols,
802+
'protocols_honor_order' => $protocols_honor_order,
803+
'user' => $user,
804+
'group' => $group,
805+
'root_directory_options' => $root_directory_options,
806+
'root_directory_secured' => $root_directory_secured,
807+
'default_charset' => $default_charset,
808+
'hostname_lookups' => $hostname_lookups,
809+
'error_log' => $error_log,
810+
'logroot' => $logroot,
811+
'log_level' => $log_level,
812+
'sendfile' => $sendfile,
813+
'allow_encoded_slashes' => $allow_encoded_slashes,
814+
'file_e_tag' => $file_e_tag,
815+
'use_canonical_name' => $use_canonical_name,
816+
'apxs_workaround' => $apxs_workaround,
817+
'mod_load_dir' => $mod_load_dir,
818+
'confd_dir' => $confd_dir,
819+
'vhost_load_dir' => $vhost_load_dir,
820+
'vhost_include_pattern' => $vhost_include_pattern,
821+
'ports_file' => $ports_file,
822+
'log_formats' => $log_formats,
823+
'conf_enabled' => $conf_enabled,
824+
'ldap_verify_server_cert' => $ldap_verify_server_cert,
825+
'ldap_trusted_mode' => $ldap_trusted_mode,
826+
'error_documents' => $error_documents,
827+
'error_documents_path' => $error_documents_path,
828+
}
829+
830+
notice $conf_template
831+
785832
file { "${apache::conf_dir}/${apache::params::conf_file}":
786833
ensure => file,
787834
mode => $apache::file_mode,
788-
content => template($conf_template),
835+
content => epp($conf_template, $parameters),
789836
notify => Class['Apache::Service'],
790837
require => [Package['httpd'], Concat[$ports_file]],
791838
}

manifests/listen.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
# Template uses: $listen_addr_port
1111
concat::fragment { "Listen ${listen_addr_port}":
1212
target => $apache::ports_file,
13-
content => template('apache/listen.erb'),
13+
content => epp('apache/listen.epp', { 'listen_addr_port' => $listen_addr_port }),
1414
}
1515
}

manifests/namevirtualhost.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
# Template uses: $addr_port
1111
concat::fragment { "NameVirtualHost ${addr_port}":
1212
target => $apache::ports_file,
13-
content => template('apache/namevirtualhost.erb'),
13+
content => epp('apache/namevirtualhost.epp', { 'addr_port' => $addr_port }),
1414
}
1515
}

manifests/params.pp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
$mod_libs = {
9696
'nss' => 'libmodnss.so',
9797
}
98-
$conf_template = 'apache/httpd.conf.erb'
98+
$conf_template = 'apache/httpd.conf.epp'
9999
$http_protocol_options = undef
100100
$keepalive = 'On'
101101
$keepalive_timeout = 15
@@ -231,7 +231,7 @@
231231
default => 'mod_wsgi_python3.so',
232232
},
233233
}
234-
$conf_template = 'apache/httpd.conf.erb'
234+
$conf_template = 'apache/httpd.conf.epp'
235235
$http_protocol_options = undef
236236
$keepalive = 'On'
237237
$keepalive_timeout = 15
@@ -383,7 +383,7 @@
383383
$mod_libs = {
384384
'shib2' => $shib2_lib,
385385
}
386-
$conf_template = 'apache/httpd.conf.erb'
386+
$conf_template = 'apache/httpd.conf.epp'
387387
$http_protocol_options = undef
388388
$keepalive = 'On'
389389
$keepalive_timeout = 15
@@ -492,7 +492,7 @@
492492
}
493493
$mod_libs = {
494494
}
495-
$conf_template = 'apache/httpd.conf.erb'
495+
$conf_template = 'apache/httpd.conf.epp'
496496
$http_protocol_options = undef
497497
$keepalive = 'On'
498498
$keepalive_timeout = 15
@@ -558,7 +558,7 @@
558558
}
559559
$mod_libs = {
560560
}
561-
$conf_template = 'apache/httpd.conf.erb'
561+
$conf_template = 'apache/httpd.conf.epp'
562562
$http_protocol_options = undef
563563
$keepalive = 'On'
564564
$keepalive_timeout = 15
@@ -633,7 +633,7 @@
633633
'security' => '/usr/lib64/apache2/mod_security2.so',
634634
'php53' => '/usr/lib64/apache2/mod_php5.so',
635635
}
636-
$conf_template = 'apache/httpd.conf.erb'
636+
$conf_template = 'apache/httpd.conf.epp'
637637
$http_protocol_options = undef
638638
$keepalive = 'On'
639639
$keepalive_timeout = 15

readmes/README_ja_JP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ Apacheサーバのメイン設定ファイルを置くディレクトリを設
883883

884884
メインのApache設定ファイルで使用される[テンプレート][]を定義します。apacheモジュールは、`conf.d`エントリによりカスタマイズされた最小限の設定ファイルを使用するように設計されているため、このパラメータの変更には潜在的なリスクが伴います。
885885

886-
デフォルト値: `apache/httpd.conf.erb`
886+
デフォルト値: `apache/httpd.conf.epp`
887887

888888
##### `confd_dir`
889889

spec/acceptance/apache_parameters_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
end
1212

1313
if os[:family] == 'freebsd'
14-
describe file("#{apache_hash['confd_dir']}/no-accf.conf.erb") do
14+
describe file("#{apache_hash['confd_dir']}/no-accf.conf.epp") do
1515
it { is_expected.not_to be_file }
1616
end
1717
end
@@ -24,7 +24,7 @@
2424
end
2525

2626
if os[:family] == 'freebsd'
27-
describe file("#{apache_hash['confd_dir']}/no-accf.conf.erb") do
27+
describe file("#{apache_hash['confd_dir']}/no-accf.conf.epp") do
2828
it { is_expected.to be_file }
2929
end
3030
end
@@ -310,9 +310,9 @@ class { 'apache': httpd_dir => '/tmp', service_ensure => stopped }
310310
describe 'conf_template' do
311311
describe 'setup' do
312312
it 'applies cleanly' do
313-
pp = "class { 'apache': conf_template => 'another/test.conf.erb', service_ensure => stopped }"
313+
pp = "class { 'apache': conf_template => 'another/test.conf.epp', service_ensure => stopped }"
314314
run_shell('mkdir -p /etc/puppetlabs/code/environments/production/modules/another/templates')
315-
run_shell("echo 'testcontent' >> /etc/puppetlabs/code/environments/production/modules/another/templates/test.conf.erb")
315+
run_shell("echo 'testcontent' >> /etc/puppetlabs/code/environments/production/modules/another/templates/test.conf.epp")
316316
apply_manifest(pp, catch_failures: true)
317317
end
318318
end

spec/classes/apache_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,15 +433,15 @@
433433

434434
describe 'different templates for httpd.conf with default' do
435435
let :params do
436-
{ conf_template: 'apache/httpd.conf.erb' }
436+
{ conf_template: 'apache/httpd.conf.epp' }
437437
end
438438

439439
it { is_expected.to contain_file('/etc/httpd/conf/httpd.conf').with_content %r{^# Security\n} }
440440
end
441441

442442
describe 'different templates for httpd.conf with non-default' do
443443
let :params do
444-
{ conf_template: 'site_apache/fake.conf.erb' }
444+
{ conf_template: 'site_apache/fake.conf.epp' }
445445
end
446446

447447
it { is_expected.to contain_file('/etc/httpd/conf/httpd.conf').with_content %r{^Fake template for rspec.$} }

0 commit comments

Comments
 (0)