File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 327327 ensure => file ,
328328 content => template ($conf_template ),
329329 notify => Class[' Apache::Service' ],
330- require => Package[' httpd' ],
330+ require => [ Package[' httpd' ], File [ $ports_file ] ],
331331 }
332332
333333 # preserve back-wards compatibility to the times when default_mods was
Original file line number Diff line number Diff line change @@ -52,4 +52,25 @@ class { 'apache': }
5252 it { is_expected . to be_file }
5353 end
5454 end
55+
56+ describe 'custom_config only applied after configs are written' do
57+ it 'applies in the right order' do
58+ pp = <<-EOS
59+ class { 'apache': }
60+
61+ apache::custom_config { 'ordering_test':
62+ content => '# just a comment',
63+ }
64+
65+ # Try to wedge the apache::custom_config call between when httpd.conf is written and
66+ # ports.conf is written. This should trigger a dependency cycle
67+ File["#{ $conf_file} "] -> Apache::Custom_config['ordering_test'] -> File["#{ $ports_file} "]
68+ EOS
69+ expect ( apply_manifest ( pp , :expect_failures => true ) . stderr ) . to match ( /Failed to apply catalog: Found 1 dependency cycle/i )
70+ end
71+
72+ describe file ( "#{ $confd_dir} /25-ordering_test.conf" ) do
73+ it { is_expected . not_to be_file }
74+ end
75+ end
5576end
Original file line number Diff line number Diff line change 480480 it { is_expected . to contain_file ( "/opt/rh/root/etc/httpd/conf/httpd.conf" ) . with (
481481 'ensure' => 'file' ,
482482 'notify' => 'Class[Apache::Service]' ,
483- 'require' => 'Package[httpd]'
483+ 'require' => [ 'Package[httpd]' , 'File[/etc/httpd/conf/ports.conf]' ] ,
484484 ) }
485485 end
486486
You can’t perform that action at this time.
0 commit comments