Fix aix/windows ownership issues and vardir path
This commit is contained in:
parent
eaa84694b1
commit
8b852e2b89
5 changed files with 71 additions and 91 deletions
|
@ -1,5 +1,17 @@
|
||||||
require 'spec_helper_acceptance'
|
require 'spec_helper_acceptance'
|
||||||
|
|
||||||
|
case fact('osfamily')
|
||||||
|
when 'AIX'
|
||||||
|
username = 'root'
|
||||||
|
groupname = 'system'
|
||||||
|
when 'windows'
|
||||||
|
username = 'Administrator'
|
||||||
|
groupname = 'Administrators'
|
||||||
|
else
|
||||||
|
username = 'root'
|
||||||
|
groupname = 'root'
|
||||||
|
end
|
||||||
|
|
||||||
describe 'basic concat test' do
|
describe 'basic concat test' do
|
||||||
|
|
||||||
shared_examples 'successfully_applied' do |pp|
|
shared_examples 'successfully_applied' do |pp|
|
||||||
|
@ -9,12 +21,12 @@ describe 'basic concat test' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'owner/group root' do
|
context 'owner/group' do
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include concat::setup
|
include concat::setup
|
||||||
concat { '/tmp/concat/file':
|
concat { '/tmp/concat/file':
|
||||||
owner => 'root',
|
owner => '#{username}',
|
||||||
group => 'root',
|
group => '#{groupname}',
|
||||||
mode => '0644',
|
mode => '0644',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,78 +47,32 @@ describe 'basic concat test' do
|
||||||
|
|
||||||
describe file('/tmp/concat/file') do
|
describe file('/tmp/concat/file') do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
it { should be_owned_by 'root' }
|
it { should be_owned_by username }
|
||||||
it { should be_grouped_into 'root' }
|
it { should be_grouped_into groupname }
|
||||||
it { should be_mode 644 }
|
# XXX file be_mode isn't supported on AIX
|
||||||
|
it("should be mode 644", :unless => fact('osfamily') == "AIX") {
|
||||||
|
should be_mode 644
|
||||||
|
}
|
||||||
it { should contain '1' }
|
it { should contain '1' }
|
||||||
it { should contain '2' }
|
it { should contain '2' }
|
||||||
end
|
end
|
||||||
describe file("#{default['puppetvardir']}/concat/_tmp_concat_file/fragments/01_1") do
|
describe file("#{default.puppet['vardir']}/concat/_tmp_concat_file/fragments/01_1") do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
it { should be_owned_by 'root' }
|
it { should be_owned_by username }
|
||||||
it { should be_grouped_into 'root' }
|
it { should be_grouped_into groupname }
|
||||||
it { should be_mode 644 }
|
# XXX file be_mode isn't supported on AIX
|
||||||
end
|
it("should be mode 644", :unless => fact('osfamily') == "AIX") {
|
||||||
describe file("#{default['puppetvardir']}/concat/_tmp_concat_file/fragments/02_2") do
|
should be_mode 644
|
||||||
it { should be_file }
|
|
||||||
it { should be_owned_by 'root' }
|
|
||||||
it { should be_grouped_into 'root' }
|
|
||||||
it { should be_mode 644 }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'owner/group non-root' do
|
|
||||||
before(:all) do
|
|
||||||
shell "groupadd -g 64444 bob"
|
|
||||||
shell "useradd -u 42 -g 64444 bob"
|
|
||||||
end
|
|
||||||
after(:all) do
|
|
||||||
shell "userdel bob"
|
|
||||||
end
|
|
||||||
|
|
||||||
pp="
|
|
||||||
concat { '/tmp/concat/file':
|
|
||||||
owner => 'bob',
|
|
||||||
group => 'bob',
|
|
||||||
mode => '0644',
|
|
||||||
}
|
}
|
||||||
|
end
|
||||||
concat::fragment { '1':
|
describe file("#{default.puppet['vardir']}/concat/_tmp_concat_file/fragments/02_2") do
|
||||||
target => '/tmp/concat/file',
|
it { should be_file }
|
||||||
content => '1',
|
it { should be_owned_by username }
|
||||||
order => '01',
|
it { should be_grouped_into groupname }
|
||||||
|
# XXX file be_mode isn't supported on AIX
|
||||||
|
it("should be mode 644", :unless => fact('osfamily') == "AIX") {
|
||||||
|
should be_mode 644
|
||||||
}
|
}
|
||||||
|
|
||||||
concat::fragment { '2':
|
|
||||||
target => '/tmp/concat/file',
|
|
||||||
content => '2',
|
|
||||||
order => '02',
|
|
||||||
}
|
|
||||||
"
|
|
||||||
|
|
||||||
it_behaves_like 'successfully_applied', pp
|
|
||||||
|
|
||||||
describe file('/tmp/concat/file') do
|
|
||||||
it { should be_file }
|
|
||||||
it { should be_owned_by 'bob' }
|
|
||||||
it { should be_grouped_into 'bob' }
|
|
||||||
it { should be_mode 644 }
|
|
||||||
it { should contain '1' }
|
|
||||||
it { should contain '2' }
|
|
||||||
end
|
|
||||||
describe file("#{default['puppetvardir']}/concat/_tmp_concat_file/fragments/01_1") do
|
|
||||||
it { should be_file }
|
|
||||||
it { should be_owned_by 'root' }
|
|
||||||
it { should be_grouped_into 'root' }
|
|
||||||
it { should be_mode 644 }
|
|
||||||
it { should contain '1' }
|
|
||||||
end
|
|
||||||
describe file("#{default['puppetvardir']}/concat/_tmp_concat_file/fragments/02_2") do
|
|
||||||
it { should be_file }
|
|
||||||
it { should be_owned_by 'root' }
|
|
||||||
it { should be_grouped_into 'root' }
|
|
||||||
it { should be_mode 644 }
|
|
||||||
it { should contain '2' }
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,9 +3,8 @@ require 'spec_helper_acceptance'
|
||||||
describe 'concat force empty parameter' do
|
describe 'concat force empty parameter' do
|
||||||
context 'should run successfully' do
|
context 'should run successfully' do
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
|
include concat::setup
|
||||||
concat { '/tmp/concat/file':
|
concat { '/tmp/concat/file':
|
||||||
owner => root,
|
|
||||||
group => root,
|
|
||||||
mode => '0644',
|
mode => '0644',
|
||||||
force => true,
|
force => true,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,17 @@
|
||||||
require 'spec_helper_acceptance'
|
require 'spec_helper_acceptance'
|
||||||
|
|
||||||
|
case fact('osfamily')
|
||||||
|
when 'AIX'
|
||||||
|
username = 'root'
|
||||||
|
groupname = 'system'
|
||||||
|
when 'windows'
|
||||||
|
username = 'Administrator'
|
||||||
|
groupname = 'Administrators'
|
||||||
|
else
|
||||||
|
username = 'root'
|
||||||
|
groupname = 'root'
|
||||||
|
end
|
||||||
|
|
||||||
describe 'concat::fragment source' do
|
describe 'concat::fragment source' do
|
||||||
context 'should read file fragments from local system' do
|
context 'should read file fragments from local system' do
|
||||||
before(:all) do
|
before(:all) do
|
||||||
|
@ -49,18 +61,18 @@ describe 'concat::fragment source' do
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include concat::setup
|
include concat::setup
|
||||||
concat { '/tmp/concat/result_file1':
|
concat { '/tmp/concat/result_file1':
|
||||||
owner => root,
|
owner => '#{username}',
|
||||||
group => root,
|
group => '#{groupname}',
|
||||||
mode => '0644',
|
mode => '0644',
|
||||||
}
|
}
|
||||||
concat { '/tmp/concat/result_file2':
|
concat { '/tmp/concat/result_file2':
|
||||||
owner => root,
|
owner => '#{username}',
|
||||||
group => root,
|
group => '#{groupname}',
|
||||||
mode => '0644',
|
mode => '0644',
|
||||||
}
|
}
|
||||||
concat { '/tmp/concat/result_file3':
|
concat { '/tmp/concat/result_file3':
|
||||||
owner => root,
|
owner => '#{username}',
|
||||||
group => root,
|
group => '#{groupname}',
|
||||||
mode => '0644',
|
mode => '0644',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,8 +124,8 @@ describe 'concat::fragment source' do
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include concat::setup
|
include concat::setup
|
||||||
concat { '/tmp/concat/fail_no_source':
|
concat { '/tmp/concat/fail_no_source':
|
||||||
owner => root,
|
owner => '#{username}',
|
||||||
group => root,
|
group => '#{groupname}',
|
||||||
mode => '0644',
|
mode => '0644',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,8 @@ describe 'replacement of' do
|
||||||
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
|
||||||
end
|
end
|
||||||
|
|
||||||
describe file('/tmp/concat/file') do
|
# XXX specinfra doesn't support be_linked_to on AIX
|
||||||
|
describe file('/tmp/concat/file'), :unless => fact('osfamily') == "AIX" do
|
||||||
it { should be_linked_to '/tmp/concat/dangling' }
|
it { should be_linked_to '/tmp/concat/dangling' }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
require 'beaker-rspec/spec_helper'
|
require 'beaker-rspec/spec_helper'
|
||||||
require 'beaker-rspec/helpers/serverspec'
|
require 'beaker-rspec/helpers/serverspec'
|
||||||
|
|
||||||
|
unless ENV['RS_PROVISION'] == 'no'
|
||||||
hosts.each do |host|
|
hosts.each do |host|
|
||||||
if host['platform'] =~ /debian/
|
if host['platform'] =~ /debian/
|
||||||
on host, 'echo \'export PATH=/var/lib/gems/1.8/bin/:${PATH}\' >> ~/.bashrc'
|
on host, 'echo \'export PATH=/var/lib/gems/1.8/bin/:${PATH}\' >> ~/.bashrc'
|
||||||
|
@ -14,6 +15,7 @@ hosts.each do |host|
|
||||||
on host, "mkdir -p #{host['distmoduledir']}"
|
on host, "mkdir -p #{host['distmoduledir']}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
RSpec.configure do |c|
|
RSpec.configure do |c|
|
||||||
# Project root
|
# Project root
|
||||||
|
@ -35,7 +37,7 @@ RSpec.configure do |c|
|
||||||
shell('mkdir -p /tmp/concat')
|
shell('mkdir -p /tmp/concat')
|
||||||
end
|
end
|
||||||
c.after(:all) do
|
c.after(:all) do
|
||||||
shell('rm -rf /tmp/concat /var/lib/puppet/concat')
|
shell("rm -rf /tmp/concat #{default.puppet['vardir']}/concat")
|
||||||
end
|
end
|
||||||
|
|
||||||
c.treat_symbols_as_metadata_keys_with_true_values = true
|
c.treat_symbols_as_metadata_keys_with_true_values = true
|
||||||
|
|
Loading…
Reference in a new issue