Skip to content

Commit 4d45394

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 dbbcff7 commit 4d45394

File tree

3 files changed

+46
-4
lines changed

3 files changed

+46
-4
lines changed

examples/discovery_images.pp

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class { 'foreman_proxy':
2+
tftp => true,
3+
}
4+
class { 'foreman_proxy::plugin::discovery':
5+
install_images => true,
6+
}

manifests/plugin/discovery.pp

+2
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

+38-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,47 @@
11
require 'spec_helper_acceptance'
2+
require 'json'
3+
4+
shared_examples 'the discovery feature is enabled' do
5+
describe command('curl -sk https://127.0.0.1:8443/features') do
6+
it { expect(JSON.parse(subject.stdout)).to include('discovery', 'logs') }
7+
its(:exit_status) { is_expected.to eq (0) }
8+
end
9+
end
210

311
describe 'Scenario: install foreman-proxy with discovery plugin' do
412
before(:context) { purge_foreman_proxy }
513

6-
include_examples 'the example', 'discovery.pp'
14+
context 'without params' do
15+
include_examples 'the example', 'discovery.pp'
16+
17+
it_behaves_like 'the default foreman proxy application'
18+
it_behaves_like 'the discovery feature is enabled'
19+
end
20+
21+
context 'with install_images param' do
22+
include_examples 'the example', 'discovery_images.pp'
23+
24+
it_behaves_like 'the default foreman proxy application'
25+
it_behaves_like 'the discovery feature is enabled'
726

8-
it_behaves_like 'the default foreman proxy application'
27+
%w[
28+
/boot/fdi-image-latest.tar
29+
/boot/fdi-image/initrd0.img
30+
/boot/fdi-image/vmlinuz0
31+
].each do |f|
32+
describe file(File.join(tftp_root, f)) do
33+
it { is_expected.to be_file }
34+
it { is_expected.to be_owned_by 'foreman-proxy' }
35+
it { is_expected.to be_grouped_into 'foreman-proxy' }
36+
it { is_expected.to be_mode '644' }
37+
end
38+
end
939

10-
describe command('curl -sk https://127.0.0.1:8443/features | grep -q discovery') do
11-
its(:exit_status) { should eq 0 }
40+
describe file(File.join(tftp_root, '/boot/fdi-image')) do
41+
it { is_expected.to be_directory }
42+
it { is_expected.to be_owned_by 'foreman-proxy' }
43+
it { is_expected.to be_grouped_into 'foreman-proxy' }
44+
it { is_expected.to be_mode '755' }
45+
end
1246
end
1347
end

0 commit comments

Comments
 (0)