-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
untar fdi-image as proxy user/group #774
Open
jhoblitt
wants to merge
4
commits into
theforeman:master
Choose a base branch
from
jhoblitt:feature/fdi-ownership
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
25af7c3
factor #tftp_root out of spec/acceptance/netboot_spec.rb
jhoblitt bd4694a
add remote_file::{owner,group} optional params
jhoblitt dbbcff7
change ownership of downloaded fdi-image to proxy user/group
jhoblitt 4d45394
untar fdi-image as proxy user/group
jhoblitt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class { 'foreman_proxy': | ||
tftp => true, | ||
} | ||
class { 'foreman_proxy::plugin::discovery': | ||
install_images => true, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,47 @@ | ||
require 'spec_helper_acceptance' | ||
require 'json' | ||
|
||
shared_examples 'the discovery feature is enabled' do | ||
describe command('curl -sk https://127.0.0.1:8443/features') do | ||
it { expect(JSON.parse(subject.stdout)).to include('discovery', 'logs') } | ||
its(:exit_status) { is_expected.to eq (0) } | ||
end | ||
end | ||
|
||
describe 'Scenario: install foreman-proxy with discovery plugin' do | ||
before(:context) { purge_foreman_proxy } | ||
|
||
include_examples 'the example', 'discovery.pp' | ||
context 'without params' do | ||
include_examples 'the example', 'discovery.pp' | ||
|
||
it_behaves_like 'the default foreman proxy application' | ||
it_behaves_like 'the discovery feature is enabled' | ||
end | ||
|
||
context 'with install_images param' do | ||
include_examples 'the example', 'discovery_images.pp' | ||
|
||
it_behaves_like 'the default foreman proxy application' | ||
it_behaves_like 'the discovery feature is enabled' | ||
|
||
it_behaves_like 'the default foreman proxy application' | ||
%w[ | ||
/boot/fdi-image-latest.tar | ||
/boot/fdi-image/initrd0.img | ||
/boot/fdi-image/vmlinuz0 | ||
].each do |f| | ||
describe file(File.join(tftp_root, f)) do | ||
it { is_expected.to be_file } | ||
it { is_expected.to be_owned_by 'foreman-proxy' } | ||
it { is_expected.to be_grouped_into 'foreman-proxy' } | ||
it { is_expected.to be_mode '644' } | ||
end | ||
end | ||
|
||
describe command('curl -sk https://127.0.0.1:8443/features | grep -q discovery') do | ||
its(:exit_status) { should eq 0 } | ||
describe file(File.join(tftp_root, '/boot/fdi-image')) do | ||
it { is_expected.to be_directory } | ||
it { is_expected.to be_owned_by 'foreman-proxy' } | ||
it { is_expected.to be_grouped_into 'foreman-proxy' } | ||
it { is_expected.to be_mode '755' } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,64 @@ | ||
require 'spec_helper' | ||
|
||
shared_examples 'remote_file' do | ||
it { is_expected.to contain_exec('mkdir -p /tmp') } | ||
end | ||
|
||
describe 'foreman_proxy::remote_file' do | ||
let(:title) { '/tmp/a' } | ||
|
||
let(:params) do | ||
{ | ||
remote_location: 'https://example.com/tmp/a', | ||
mode: '0664' | ||
} | ||
end | ||
context 'without owner/group params' do | ||
let(:params) do | ||
{ | ||
remote_location: 'https://example.com/tmp/a', | ||
mode: '0664' | ||
} | ||
end | ||
|
||
context 'default scenario' do | ||
it { is_expected.to contain_exec('mkdir -p /tmp') } | ||
context 'default scenario' do | ||
include_examples 'remote_file' | ||
|
||
it do | ||
is_expected.to contain_file('/tmp/a') | ||
.with_source('https://example.com/tmp/a') | ||
.with_mode('0664') | ||
.that_requires('Exec[mkdir -p /tmp]') | ||
it do | ||
is_expected.to contain_file('/tmp/a').with( | ||
source: 'https://example.com/tmp/a', | ||
mode: '0664', | ||
owner: nil, | ||
group: nil, | ||
).without( | ||
).that_requires('Exec[mkdir -p /tmp]') | ||
end | ||
end | ||
|
||
context 'with parent file defined' do | ||
let :pre_condition do | ||
"file { '/tmp': }" | ||
end | ||
|
||
include_examples 'remote_file' | ||
|
||
it { is_expected.to contain_exec('mkdir -p /tmp').that_requires('File[/tmp]') } | ||
end | ||
end | ||
|
||
context 'with parent file defined' do | ||
let :pre_condition do | ||
"file { '/tmp': }" | ||
context 'with owner/group params' do | ||
let(:params) do | ||
{ | ||
remote_location: 'https://example.com/tmp/a', | ||
mode: '0664', | ||
owner: 'foo', | ||
group: 'bar', | ||
} | ||
end | ||
|
||
it { is_expected.to contain_exec('mkdir -p /tmp').that_requires('File[/tmp]') } | ||
include_examples 'remote_file' | ||
|
||
it do | ||
is_expected.to contain_file('/tmp/a').with( | ||
source: 'https://example.com/tmp/a', | ||
mode: '0664', | ||
owner: 'foo', | ||
group: 'bar', | ||
).that_requires('Exec[mkdir -p /tmp]') | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
def tftp_root | ||
case host_inventory['facter']['os']['name'] | ||
when 'Debian', 'Ubuntu' | ||
'/srv/tftp' | ||
else | ||
'/var/lib/tftpboot' | ||
end | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.