Skip to content

Commit d6a96a8

Browse files
committed
untar fdi-image as proxy user/group
To prevent fdi-image files from being chown'd on subsequent puppet agent runs.
1 parent 629c30f commit d6a96a8

File tree

3 files changed

+42
-4
lines changed

3 files changed

+42
-4
lines changed

examples/discovery_images.pp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include foreman_proxy
2+
class { 'foreman_proxy::plugin::discovery':
3+
install_images => true,
4+
}

manifests/plugin/discovery.pp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
4949
cwd => "${tftp_root_clean}/boot",
5050
creates => "${tftp_root_clean}/boot/fdi-image/initrd0.img",
51+
user => $foreman_proxy::user,
52+
group => $foreman_proxy::group,
5153
}
5254
}
5355
}

spec/acceptance/discovery_spec.rb

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,43 @@
33
describe 'Scenario: install foreman-proxy with discovery plugin' do
44
before(:context) { purge_foreman_proxy }
55

6-
include_examples 'the example', 'discovery.pp'
6+
context 'without params' do
7+
include_examples 'the example', 'discovery.pp'
78

8-
it_behaves_like 'the default foreman proxy application'
9+
it_behaves_like 'the default foreman proxy application'
910

10-
describe command('curl -sk https://127.0.0.1:8443/features | grep -q discovery') do
11-
its(:exit_status) { should eq 0 }
11+
describe command('curl -sk https://127.0.0.1:8443/features | grep -q discovery') do
12+
its(:exit_status) { should eq 0 }
13+
end
14+
end
15+
16+
context 'with install_images param' do
17+
include_examples 'the example', 'discovery_images.pp'
18+
19+
it_behaves_like 'the default foreman proxy application'
20+
21+
describe command('curl -sk https://127.0.0.1:8443/features | grep -q discovery') do
22+
its(:exit_status) { should eq 0 }
23+
end
24+
25+
%w[
26+
/var/lib/tftpboot/boot/fdi-image-latest.tar
27+
/var/lib/tftpboot/boot/fdi-image/initrd0.img
28+
/var/lib/tftpboot/boot/fdi-image/vmlinuz0
29+
].each do |f|
30+
describe file(f) do
31+
it { is_expected.to be_file }
32+
it { is_expected.to be_owned_by 'foreman-proxy' }
33+
it { is_expected.to be_grouped_into 'foreman-proxy' }
34+
it { is_expected.to be_mode '644' }
35+
end
36+
end
37+
38+
describe file('/var/lib/tftpboot/boot/fdi-image') do
39+
it { is_expected.to be_directory }
40+
it { is_expected.to be_owned_by 'foreman-proxy' }
41+
it { is_expected.to be_grouped_into 'foreman-proxy' }
42+
it { is_expected.to be_mode '755' }
43+
end
1244
end
1345
end

0 commit comments

Comments
 (0)