Merge pull request #224 from puppetlabs/1.1.x

1.1.x
This commit is contained in:
Morgan Haskel 2014-09-10 19:29:37 -04:00
commit c5f2f4772f
16 changed files with 479 additions and 335 deletions

View file

@ -1,21 +1,41 @@
2014-05-14 1.1.0
##2014-09-10 - Supported Release 1.1.1
Summary
###Summary
This is a bugfix release, and the first supported release of the 1.1.x series.
####Bugfixes
- Make the `$order` parameter default to a string and be validated as an integer
or a string
- Use the ruby script on Solaris to not break Sol10 support
- Add quotes to the ryby script location for Windows
- Fix typos in README.md
- Make regex in concat::setup case-insensitive to make it work on Windows
- Make sure concat fragments are always replaced
- Fix validation to allow `$backup` to be a boolean
- Remove dependency on stdlib 4.x
- Fix for lack of idempotency with `ensure => 'absent'`
- Fix tests and spec_helper
- Synchronized files for more consistency across modules via modulesync
##2014-05-14 - Release 1.1.0
###Summary
This release is primarily a bugfix release since 1.1.0-rc1.
Features:
####Features
- Improved testing, with tests moved to beaker
Bugfixes:
####Bugfixes
- No longer attempts to set fragment owner and mode on Windows
- Fix numeric sorting
- Fix incorrect quoting
- Fix newlines
2014-01-03 1.1.0-rc1
##2014-01-03 - Release 1.1.0-rc1
Summary:
###Summary
This release of concat was 90% written by Joshua Hoblitt, and the module team
would like to thank him for the huge amount of work he put into this release.
@ -33,49 +53,106 @@ warnings and we'll be aggressively moving for a 2.0 to remove those too.
For further information on deprecations, please read:
https://github.com/puppetlabs/puppetlabs-concat/blob/master/README.md#api-deprecations
Removed:
####Removed
- Puppet 0.24 support.
- Filebucket backup of all file resources except the target concatenated file.
- Default owner/user/group values.
- Purging of long unused /usr/local/bin/concatfragments.sh
Features:
###Features
- Windows support via a ruby version of the concat bash script.
- Huge amount of acceptance testing work added.
- Documentation (README) completely rewritten.
- New parameters in concat:
- `ensure`: Controls if the file should be present/absent at all.
- Remove requirement to include concat::setup in manifests.
- Made `gnu` parameter deprecated.
- Added parameter validation.
- Remove requirement to include concat::setup in manifests.
- Made `gnu` parameter deprecated.
- Added parameter validation.
Bugfixes:
- Ensure concat::setup runs before concat::fragment in all cases.
- Pluginsync references updated for modern Puppet.
- Fix incorrect group parameter.
- Use $owner instead of $id to avoid confusion with $::id
- Compatibility fixes for Puppet 2.7/ruby 1.8.7
- Use LC_ALL=C instead of LANG=C
- Always exec the concatfragments script as root when running as root.
- Syntax and other cleanup changes.
###Bugfixes
- Ensure concat::setup runs before concat::fragment in all cases.
- Pluginsync references updated for modern Puppet.
- Fix incorrect group parameter.
- Use $owner instead of $id to avoid confusion with $::id
- Compatibility fixes for Puppet 2.7/ruby 1.8.7
- Use LC_ALL=C instead of LANG=C
- Always exec the concatfragments script as root when running as root.
- Syntax and other cleanup changes.
2013-08-09 1.0.0
##2014-06-25 - Supported Release 1.0.4
###Summary
Summary:
This release has test fixes.
####Features
- Added test support for OSX.
####Bugfixes
####Known bugs
* Not supported on Windows.
##2014-06-04 - Release 1.0.3
###Summary
This release adds compatibility for PE3.3 and fixes tests.
####Features
- Added test support for Ubuntu Trusty.
####Bugfixes
####Known bugs
*Not supported on Windows.
##2014-03-04 - Supported Release 1.0.2
###Summary
This is a supported release. No functional changes were made from 1.0.1.
####Features
- Huge amount of tests backported from 1.1.
- Documentation rewrite.
####Bugfixes
####Known Bugs
* Not supported on Windows.
##2014-02-12 - 1.0.1
###Summary
Minor bugfixes for sorting of fragments and ordering of resources.
####Bugfixes
- LANG => C replaced with LC_ALL => C to reduce spurious recreation of
fragments.
- Corrected pluginsync documentation.
- Ensure concat::setup always runs before fragments.
##2013-08-09 - 1.0.0
###Summary
Many new features and bugfixes in this release, and if you're a heavy concat
user you should test carefully before upgrading. The features should all be
backwards compatible but only light testing has been done from our side before
this release.
Features:
####Features
- New parameters in concat:
- `replace`: specify if concat should replace existing files.
- `ensure_newline`: controls if fragments should contain a newline at the end.
- Improved README documentation.
- Add rspec:system tests (rake spec:system to test concat)
Bugfixes
####Bugfixes
- Gracefully handle \n in a fragment resource name.
- Adding more helpful message for 'pluginsync = true'
- Allow passing `source` and `content` directly to file resource, rather than
@ -85,7 +162,7 @@ defining resource defaults.
- Allow WARNMSG to contain/start with '#'.
- Replace while-read pattern with for-do in order to support Solaris.
CHANGELOG:
####CHANGELOG:
- 2010/02/19 - initial release
- 2010/03/12 - add support for 0.24.8 and newer
- make the location of sort configurable

View file

@ -1,6 +1,6 @@
{
"name": "puppetlabs-concat",
"version": "1.1.0",
"version": "1.1.1",
"author": "Puppet Labs",
"summary": "Concat module",
"license": "Apache-2.0",

View file

@ -1,49 +1,60 @@
require 'spec_helper_acceptance'
describe 'concat backup parameter' do
basedir = default.tmpdir('concat')
context '=> puppet' do
before :all do
shell('rm -rf /tmp/concat')
shell('mkdir -p /tmp/concat')
shell("/bin/echo 'old contents' > /tmp/concat/file")
before(:all) do
pp = <<-EOS
file { '#{basedir}':
ensure => directory,
}
file { '#{basedir}/file':
content => "old contents\n",
}
EOS
apply_manifest(pp)
end
pp = <<-EOS
concat { '/tmp/concat/file':
concat { '#{basedir}/file':
backup => 'puppet',
}
concat::fragment { 'new file':
target => '/tmp/concat/file',
target => '#{basedir}/file',
content => 'new contents',
}
EOS
it 'applies the manifest twice with "Filebucketed" stdout and no stderr' do
apply_manifest(pp, :catch_failures => true) do |r|
expect(r.stdout).to match(/Filebucketed \/tmp\/concat\/file to puppet with sum 0140c31db86293a1a1e080ce9b91305f/) # sum is for file contents of 'old contents'
expect(r.stdout).to match(/Filebucketed #{basedir}\/file to puppet with sum 0140c31db86293a1a1e080ce9b91305f/) # sum is for file contents of 'old contents'
end
apply_manifest(pp, :catch_changes => true)
end
describe file('/tmp/concat/file') do
describe file("#{basedir}/file") do
it { should be_file }
it { should contain 'new contents' }
end
end
context '=> .backup' do
before :all do
shell('rm -rf /tmp/concat')
shell('mkdir -p /tmp/concat')
shell("/bin/echo 'old contents' > /tmp/concat/file")
before(:all) do
pp = <<-EOS
file { '#{basedir}':
ensure => directory,
}
file { '#{basedir}/file':
content => "old contents\n",
}
EOS
apply_manifest(pp)
end
pp = <<-EOS
concat { '/tmp/concat/file':
concat { '#{basedir}/file':
backup => '.backup',
}
concat::fragment { 'new file':
target => '/tmp/concat/file',
target => '#{basedir}/file',
content => 'new contents',
}
EOS
@ -55,11 +66,11 @@ describe 'concat backup parameter' do
apply_manifest(pp, :catch_changes => true)
end
describe file('/tmp/concat/file') do
describe file("#{basedir}/file") do
it { should be_file }
it { should contain 'new contents' }
end
describe file('/tmp/concat/file.backup') do
describe file("#{basedir}/file.backup") do
it { should be_file }
it { should contain 'old contents' }
end
@ -68,18 +79,23 @@ describe 'concat backup parameter' do
# XXX The backup parameter uses validate_string() and thus can't be the
# boolean false value, but the string 'false' has the same effect in Puppet 3
context "=> 'false'" do
before :all do
shell('rm -rf /tmp/concat')
shell('mkdir -p /tmp/concat')
shell("/bin/echo 'old contents' > /tmp/concat/file")
before(:all) do
pp = <<-EOS
file { '#{basedir}':
ensure => directory,
}
file { '#{basedir}/file':
content => "old contents\n",
}
EOS
apply_manifest(pp)
end
pp = <<-EOS
concat { '/tmp/concat/file':
concat { '#{basedir}/file':
backup => '.backup',
}
concat::fragment { 'new file':
target => '/tmp/concat/file',
target => '#{basedir}/file',
content => 'new contents',
}
EOS
@ -91,7 +107,7 @@ describe 'concat backup parameter' do
apply_manifest(pp, :catch_changes => true)
end
describe file('/tmp/concat/file') do
describe file("#{basedir}/file") do
it { should be_file }
it { should contain 'new contents' }
end

View file

@ -1,6 +1,23 @@
require 'spec_helper_acceptance'
case fact('osfamily')
when 'AIX'
username = 'root'
groupname = 'system'
when 'Darwin'
username = 'root'
groupname = 'wheel'
when 'windows'
username = 'Administrator'
groupname = 'Administrators'
else
username = 'root'
groupname = 'root'
end
describe 'basic concat test' do
basedir = default.tmpdir('concat')
safe_basedir = basedir.gsub('/','_')
shared_examples 'successfully_applied' do |pp|
it 'applies the manifest twice with no stderr' do
@ -10,64 +27,86 @@ describe 'basic concat test' do
describe file("#{default['puppetvardir']}/concat") do
it { should be_directory }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
it { should be_mode 755 }
it { should be_owned_by username }
it { should be_grouped_into groupname }
it("should be mode", :unless => (fact('osfamily') == 'AIX')) {
should be_mode 755
}
end
describe file("#{default['puppetvardir']}/concat/bin") do
describe file("#{default['puppetvardir']}/concat/bin") do
it { should be_directory }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
it { should be_mode 755 }
it { should be_owned_by username }
it { should be_grouped_into groupname }
it("should be mode", :unless => (fact('osfamily') == 'AIX')) {
should be_mode 755
}
end
describe file("#{default['puppetvardir']}/concat/bin/concatfragments.sh") do
it { should be_file }
it { should be_owned_by 'root' }
#it { should be_grouped_into 'root' }
it { should be_mode 755 }
it { should be_owned_by username }
#it { should be_grouped_into groupname }
it("should be mode", :unless => (fact('osfamily') == 'AIX')) {
should be_mode 755
}
end
describe file("#{default['puppetvardir']}/concat/_tmp_concat_file") do
describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_file") do
it { should be_directory }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
it { should be_mode 750 }
it { should be_owned_by username }
it { should be_grouped_into groupname }
it("should be mode", :unless => (fact('osfamily') == 'AIX')) {
should be_mode 750
}
end
describe file("#{default['puppetvardir']}/concat/_tmp_concat_file/fragments") do
describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_file/fragments") do
it { should be_directory }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
it { should be_mode 750 }
it { should be_owned_by username }
it { should be_grouped_into groupname }
it("should be mode", :unless => (fact('osfamily') == 'AIX')) {
should be_mode 750
}
end
describe file("#{default['puppetvardir']}/concat/_tmp_concat_file/fragments.concat") do
describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_file/fragments.concat") do
it { should be_file }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
it { should be_mode 640 }
it { should be_owned_by username }
it { should be_grouped_into groupname }
it("should be mode", :unless => (fact('osfamily') == 'AIX')) {
should be_mode 640
}
end
describe file("#{default['puppetvardir']}/concat/_tmp_concat_file/fragments.concat.out") do
describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_file/fragments.concat.out") do
it { should be_file }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
it { should be_mode 640 }
it { should be_owned_by username }
it { should be_grouped_into groupname }
it("should be mode", :unless => (fact('osfamily') == 'AIX')) {
should be_mode 640
}
end
end
context 'owner/group root' do
before(:all) do
pp = <<-EOS
file { '#{basedir}':
ensure => directory,
}
EOS
apply_manifest(pp)
end
pp = <<-EOS
concat { '/tmp/concat/file':
owner => 'root',
group => 'root',
concat { '#{basedir}/file':
owner => '#{username}',
group => '#{groupname}',
mode => '0644',
}
concat::fragment { '1':
target => '/tmp/concat/file',
target => '#{basedir}/file',
content => '1',
order => '01',
}
concat::fragment { '2':
target => '/tmp/concat/file',
target => '#{basedir}/file',
content => '2',
order => '02',
}
@ -75,89 +114,48 @@ describe 'basic concat test' do
it_behaves_like 'successfully_applied', pp
describe file('/tmp/concat/file') do
describe file("#{basedir}/file") do
it { should be_file }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
it { should be_mode 644 }
it { should be_owned_by username }
it { should be_grouped_into groupname }
it("should be mode", :unless => (fact('osfamily') == 'AIX')) {
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
describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_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 640 }
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 640 }
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',
it { should be_owned_by username }
it { should be_grouped_into groupname }
it("should be mode", :unless => (fact('osfamily') == 'AIX')) {
should be_mode 640
}
concat::fragment { '1':
target => '/tmp/concat/file',
content => '1',
order => '01',
}
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
describe file("#{default['puppetvardir']}/concat/#{safe_basedir}_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 640 }
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 640 }
it { should contain '2' }
it { should be_owned_by username }
it { should be_grouped_into groupname }
it("should be mode", :unless => (fact('osfamily') == 'AIX')) {
should be_mode 640
}
end
end
context 'ensure' do
context 'works when set to present with path set' do
before(:all) do
pp = <<-EOS
file { '#{basedir}':
ensure => directory,
}
EOS
apply_manifest(pp)
end
pp="
concat { 'file':
ensure => present,
path => '/tmp/concat/file',
path => '#{basedir}/file',
mode => '0644',
}
concat::fragment { '1':
@ -169,17 +167,27 @@ describe 'basic concat test' do
it_behaves_like 'successfully_applied', pp
describe file('/tmp/concat/file') do
describe file("#{basedir}/file") do
it { should be_file }
it { should be_mode 644 }
it("should be mode", :unless => (fact('osfamily') == 'AIX')) {
should be_mode 644
}
it { should contain '1' }
end
end
context 'works when set to absent with path set' do
before(:all) do
pp = <<-EOS
file { '#{basedir}':
ensure => directory,
}
EOS
apply_manifest(pp)
end
pp="
concat { 'file':
ensure => absent,
path => '/tmp/concat/file',
path => '#{basedir}/file',
mode => '0644',
}
concat::fragment { '1':
@ -189,14 +197,12 @@ describe 'basic concat test' do
}
"
# Can't used shared examples as this will always trigger the exec when
# absent is set.
it 'applies the manifest twice with no stderr' do
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
end
describe file('/tmp/concat/file') do
describe file("#{basedir}/file") do
it { should_not be_file }
end
end

View file

@ -1,11 +1,10 @@
require 'spec_helper_acceptance'
describe 'concat force empty parameter' do
basedir = default.tmpdir('concat')
context 'should run successfully' do
pp = <<-EOS
concat { '/tmp/concat/file':
owner => root,
group => root,
concat { '#{basedir}/file':
mode => '0644',
force => true,
}
@ -16,7 +15,7 @@ describe 'concat force empty parameter' do
apply_manifest(pp, :catch_changes => true)
end
describe file('/tmp/concat/file') do
describe file("#{basedir}/file") do
it { should be_file }
it { should_not contain '1\n2' }
end

View file

@ -1,26 +1,45 @@
require 'spec_helper_acceptance'
describe 'concat::fragment source' do
context 'should read file fragments from local system' do
before(:all) do
shell("/bin/echo 'file1 contents' > /tmp/concat/file1")
shell("/bin/echo 'file2 contents' > /tmp/concat/file2")
end
case fact('osfamily')
when 'AIX'
username = 'root'
groupname = 'system'
when 'Darwin'
username = 'root'
groupname = 'wheel'
when 'windows'
username = 'Administrator'
groupname = 'Administrators'
else
username = 'root'
groupname = 'root'
end
describe 'concat::fragment source' do
basedir = default.tmpdir('concat')
context 'should read file fragments from local system' do
pp = <<-EOS
concat { '/tmp/concat/foo': }
file { '#{basedir}/file1':
content => "file1 contents\n"
}
file { '#{basedir}/file2':
content => "file2 contents\n"
}
concat { '#{basedir}/foo': }
concat::fragment { '1':
target => '/tmp/concat/foo',
source => '/tmp/concat/file1',
target => '#{basedir}/foo',
source => '#{basedir}/file1',
require => File['#{basedir}/file1'],
}
concat::fragment { '2':
target => '/tmp/concat/foo',
target => '#{basedir}/foo',
content => 'string1 contents',
}
concat::fragment { '3':
target => '/tmp/concat/foo',
source => '/tmp/concat/file2',
target => '#{basedir}/foo',
source => '#{basedir}/file2',
require => File['#{basedir}/file2'],
}
EOS
@ -29,7 +48,7 @@ describe 'concat::fragment source' do
apply_manifest(pp, :catch_changes => true)
end
describe file('/tmp/concat/foo') do
describe file("#{basedir}/foo") do
it { should be_file }
it { should contain 'file1 contents' }
it { should contain 'string1 contents' }
@ -38,43 +57,45 @@ describe 'concat::fragment source' do
end # should read file fragments from local system
context 'should create files containing first match only.' do
before(:all) do
shell('rm -rf /tmp/concat /var/lib/puppet/concat')
shell('mkdir -p /tmp/concat')
shell("/bin/echo 'file1 contents' > /tmp/concat/file1")
shell("/bin/echo 'file2 contents' > /tmp/concat/file2")
end
pp = <<-EOS
concat { '/tmp/concat/result_file1':
owner => root,
group => root,
file { '#{basedir}/file1':
content => "file1 contents\n"
}
file { '#{basedir}/file2':
content => "file2 contents\n"
}
concat { '#{basedir}/result_file1':
owner => '#{username}',
group => '#{groupname}',
mode => '0644',
}
concat { '/tmp/concat/result_file2':
owner => root,
group => root,
concat { '#{basedir}/result_file2':
owner => '#{username}',
group => '#{groupname}',
mode => '0644',
}
concat { '/tmp/concat/result_file3':
owner => root,
group => root,
concat { '#{basedir}/result_file3':
owner => '#{username}',
group => '#{groupname}',
mode => '0644',
}
concat::fragment { '1':
target => '/tmp/concat/result_file1',
source => [ '/tmp/concat/file1', '/tmp/concat/file2' ],
target => '#{basedir}/result_file1',
source => [ '#{basedir}/file1', '#{basedir}/file2' ],
require => [ File['#{basedir}/file1'], File['#{basedir}/file2'] ],
order => '01',
}
concat::fragment { '2':
target => '/tmp/concat/result_file2',
source => [ '/tmp/concat/file2', '/tmp/concat/file1' ],
target => '#{basedir}/result_file2',
source => [ '#{basedir}/file2', '#{basedir}/file1' ],
require => [ File['#{basedir}/file1'], File['#{basedir}/file2'] ],
order => '01',
}
concat::fragment { '3':
target => '/tmp/concat/result_file3',
source => [ '/tmp/concat/file1', '/tmp/concat/file2' ],
target => '#{basedir}/result_file3',
source => [ '#{basedir}/file1', '#{basedir}/file2' ],
require => [ File['#{basedir}/file1'], File['#{basedir}/file2'] ],
order => '01',
}
EOS
@ -83,17 +104,17 @@ describe 'concat::fragment source' do
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
end
describe file('/tmp/concat/result_file1') do
describe file("#{basedir}/result_file1") do
it { should be_file }
it { should contain 'file1 contents' }
it { should_not contain 'file2 contents' }
end
describe file('/tmp/concat/result_file2') do
describe file("#{basedir}/result_file2") do
it { should be_file }
it { should contain 'file2 contents' }
it { should_not contain 'file1 contents' }
end
describe file('/tmp/concat/result_file3') do
describe file("#{basedir}/result_file3") do
it { should be_file }
it { should contain 'file1 contents' }
it { should_not contain 'file2 contents' }
@ -101,22 +122,16 @@ describe 'concat::fragment source' do
end
context 'should fail if no match on source.' do
before(:all) do
shell('rm -rf /tmp/concat /var/lib/puppet/concat')
shell('mkdir -p /tmp/concat')
shell('/bin/rm -rf /tmp/concat/fail_no_source /tmp/concat/nofilehere /tmp/concat/nothereeither')
end
pp = <<-EOS
concat { '/tmp/concat/fail_no_source':
owner => root,
group => root,
concat { '#{basedir}/fail_no_source':
owner => '#{username}',
group => '#{groupname}',
mode => '0644',
}
concat::fragment { '1':
target => '/tmp/concat/fail_no_source',
source => [ '/tmp/concat/nofilehere', '/tmp/concat/nothereeither' ],
target => '#{basedir}/fail_no_source',
source => [ '#{basedir}/nofilehere', '#{basedir}/nothereeither' ],
order => '01',
}
EOS
@ -124,7 +139,7 @@ describe 'concat::fragment source' do
it 'applies the manifest with resource failures' do
apply_manifest(pp, :expect_failures => true)
end
describe file('/tmp/concat/fail_no_source') do
describe file("#{basedir}/fail_no_source") do
#FIXME: Serverspec::Type::File doesn't support exists? for some reason. so... hack.
it { should_not be_file }
it { should_not be_directory }

View file

@ -1,17 +1,27 @@
require 'spec_helper_acceptance'
describe 'concat ensure_newline parameter' do
basedir = default.tmpdir('concat')
context '=> false' do
before(:all) do
pp = <<-EOS
file { '#{basedir}':
ensure => directory
}
EOS
apply_manifest(pp)
end
pp = <<-EOS
concat { '/tmp/concat/file':
concat { '#{basedir}/file':
ensure_newline => false,
}
concat::fragment { '1':
target => '/tmp/concat/file',
target => '#{basedir}/file',
content => '1',
}
concat::fragment { '2':
target => '/tmp/concat/file',
target => '#{basedir}/file',
content => '2',
}
EOS
@ -21,7 +31,7 @@ describe 'concat ensure_newline parameter' do
apply_manifest(pp, :catch_changes => true)
end
describe file('/tmp/concat/file') do
describe file("#{basedir}/file") do
it { should be_file }
it { should contain '12' }
end
@ -29,15 +39,15 @@ describe 'concat ensure_newline parameter' do
context '=> true' do
pp = <<-EOS
concat { '/tmp/concat/file':
concat { '#{basedir}/file':
ensure_newline => true,
}
concat::fragment { '1':
target => '/tmp/concat/file',
target => '#{basedir}/file',
content => '1',
}
concat::fragment { '2':
target => '/tmp/concat/file',
target => '#{basedir}/file',
content => '2',
}
EOS
@ -45,11 +55,9 @@ describe 'concat ensure_newline parameter' do
it 'applies the manifest twice with no stderr' do
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
#XXX ensure_newline => true causes changes on every run because the files
#are modified in place.
end
describe file('/tmp/concat/file') do
describe file("#{basedir}/file") do
it { should be_file }
it { should contain "1\n2\n" }
end

View file

@ -7,4 +7,4 @@ HOSTS:
box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box
hypervisor : vagrant
CONFIG:
type: foss
type: git

View file

@ -1,10 +1,10 @@
HOSTS:
centos-64-x64.localdomain:
centos-64-x64:
roles:
- master
platform: el-6-x86_64
box : centos-65-x64-virtualbox-nocm
box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box
box : centos-64-x64-vbox4210-nocm
box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box
hypervisor : vagrant
CONFIG:
type: foss
type: git

View file

@ -7,4 +7,4 @@ HOSTS:
box_url : http://puppet-vagrant-boxes.puppetlabs.com/fedora-18-x64-vbox4210-nocm.box
hypervisor : vagrant
CONFIG:
type: foss
type: git

View file

@ -7,4 +7,4 @@ HOSTS:
box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-10044-x64-vbox4210-nocm.box
hypervisor : vagrant
CONFIG:
type: foss
type: git

View file

@ -7,4 +7,4 @@ HOSTS:
box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box
hypervisor : vagrant
CONFIG:
type: foss
type: git

View file

@ -1,26 +1,23 @@
require 'spec_helper_acceptance'
describe 'concat order' do
before(:all) do
shell('rm -rf /tmp/concat /var/lib/puppet/concat')
shell('mkdir -p /tmp/concat')
end
basedir = default.tmpdir('concat')
context '=> alpha' do
pp = <<-EOS
concat { '/tmp/concat/foo':
concat { '#{basedir}/foo':
order => 'alpha'
}
concat::fragment { '1':
target => '/tmp/concat/foo',
target => '#{basedir}/foo',
content => 'string1',
}
concat::fragment { '2':
target => '/tmp/concat/foo',
target => '#{basedir}/foo',
content => 'string2',
}
concat::fragment { '10':
target => '/tmp/concat/foo',
target => '#{basedir}/foo',
content => 'string10',
}
EOS
@ -30,27 +27,30 @@ describe 'concat order' do
apply_manifest(pp, :catch_changes => true)
end
describe file('/tmp/concat/foo') do
describe file("#{basedir}/foo") do
it { should be_file }
it { should contain "string10\nstring1\nsring2" }
#XXX Solaris 10 doesn't support multi-line grep
it("should contain string10\nstring1\nsring2", :unless => (fact('osfamily') == 'Solaris')) {
should contain "string10\nstring1\nsring2"
}
end
end
context '=> numeric' do
pp = <<-EOS
concat { '/tmp/concat/foo':
concat { '#{basedir}/foo':
order => 'numeric'
}
concat::fragment { '1':
target => '/tmp/concat/foo',
target => '#{basedir}/foo',
content => 'string1',
}
concat::fragment { '2':
target => '/tmp/concat/foo',
target => '#{basedir}/foo',
content => 'string2',
}
concat::fragment { '10':
target => '/tmp/concat/foo',
target => '#{basedir}/foo',
content => 'string10',
}
EOS
@ -60,34 +60,34 @@ describe 'concat order' do
apply_manifest(pp, :catch_changes => true)
end
describe file('/tmp/concat/foo') do
describe file("#{basedir}/foo") do
it { should be_file }
it { should contain "string1\nstring2\nsring10" }
#XXX Solaris 10 doesn't support multi-line grep
it("should contain string1\nstring2\nsring10", :unless => (fact('osfamily') == 'Solaris')) {
should contain "string1\nstring2\nsring10"
}
end
end
end # concat order
describe 'concat::fragment order' do
before(:all) do
shell('rm -rf /tmp/concat /var/lib/puppet/concat')
shell('mkdir -p /tmp/concat')
end
basedir = default.tmpdir('concat')
context '=> reverse order' do
pp = <<-EOS
concat { '/tmp/concat/foo': }
concat { '#{basedir}/foo': }
concat::fragment { '1':
target => '/tmp/concat/foo',
target => '#{basedir}/foo',
content => 'string1',
order => '15',
}
concat::fragment { '2':
target => '/tmp/concat/foo',
target => '#{basedir}/foo',
content => 'string2',
# default order 10
}
concat::fragment { '3':
target => '/tmp/concat/foo',
target => '#{basedir}/foo',
content => 'string3',
order => '1',
}
@ -98,27 +98,30 @@ describe 'concat::fragment order' do
apply_manifest(pp, :catch_changes => true)
end
describe file('/tmp/concat/foo') do
describe file("#{basedir}/foo") do
it { should be_file }
it { should contain "string3\nstring2\nsring1" }
#XXX Solaris 10 doesn't support multi-line grep
it("should contain string3\nstring2\nsring1", :unless => (fact('osfamily') == 'Solaris')) {
should contain "string3\nstring2\nsring1"
}
end
end
context '=> normal order' do
pp = <<-EOS
concat { '/tmp/concat/foo': }
concat { '#{basedir}/foo': }
concat::fragment { '1':
target => '/tmp/concat/foo',
target => '#{basedir}/foo',
content => 'string1',
order => '01',
}
concat::fragment { '2':
target => '/tmp/concat/foo',
target => '#{basedir}/foo',
content => 'string2',
order => '02'
}
concat::fragment { '3':
target => '/tmp/concat/foo',
target => '#{basedir}/foo',
content => 'string3',
order => '03',
}
@ -129,9 +132,12 @@ describe 'concat::fragment order' do
apply_manifest(pp, :catch_changes => true)
end
describe file('/tmp/concat/foo') do
describe file("#{basedir}/foo") do
it { should be_file }
it { should contain "string1\nstring2\nsring3" }
#XXX Solaris 10 doesn't support multi-line grep
it("should contain string1\nstring2\nsring3", :unless => (fact('osfamily') == 'Solaris')) {
should contain "string1\nstring2\nsring3"
}
end
end
end # concat::fragment order

View file

@ -1,28 +1,32 @@
require 'spec_helper_acceptance'
describe 'replacement of' do
basedir = default.tmpdir('concat')
context 'file' do
context 'should not succeed' do
before(:all) do
shell('mkdir -p /tmp/concat')
shell('echo "file exists" > /tmp/concat/file')
pp = <<-EOS
file { '#{basedir}':
ensure => directory,
}
file { '#{basedir}/file':
content => "file exists\n"
}
EOS
apply_manifest(pp)
end
after(:all) do
shell('rm -rf /tmp/concat /var/lib/puppet/concat')
end
pp = <<-EOS
concat { '/tmp/concat/file':
concat { '#{basedir}/file':
replace => false,
}
concat::fragment { '1':
target => '/tmp/concat/file',
target => '#{basedir}/file',
content => '1',
}
concat::fragment { '2':
target => '/tmp/concat/file',
target => '#{basedir}/file',
content => '2',
}
EOS
@ -32,7 +36,7 @@ describe 'replacement of' do
apply_manifest(pp, :catch_changes => true)
end
describe file('/tmp/concat/file') do
describe file("#{basedir}/file") do
it { should be_file }
it { should contain 'file exists' }
it { should_not contain '1' }
@ -42,25 +46,28 @@ describe 'replacement of' do
context 'should succeed' do
before(:all) do
shell('mkdir -p /tmp/concat')
shell('echo "file exists" > /tmp/concat/file')
pp = <<-EOS
file { '#{basedir}':
ensure => directory,
}
file { '#{basedir}/file':
content => "file exists\n"
}
EOS
apply_manifest(pp)
end
after(:all) do
shell('rm -rf /tmp/concat /var/lib/puppet/concat')
end
pp = <<-EOS
concat { '/tmp/concat/file':
concat { '#{basedir}/file':
replace => true,
}
concat::fragment { '1':
target => '/tmp/concat/file',
target => '#{basedir}/file',
content => '1',
}
concat::fragment { '2':
target => '/tmp/concat/file',
target => '#{basedir}/file',
content => '2',
}
EOS
@ -70,7 +77,7 @@ describe 'replacement of' do
apply_manifest(pp, :catch_changes => true)
end
describe file('/tmp/concat/file') do
describe file("#{basedir}/file") do
it { should be_file }
it { should_not contain 'file exists' }
it { should contain '1' }
@ -85,25 +92,30 @@ describe 'replacement of' do
# when using ensure => present and source => ... but it will not when using
# ensure => present and content => ...; this is somewhat confusing behavior
before(:all) do
shell('mkdir -p /tmp/concat')
shell('ln -s /tmp/concat/dangling /tmp/concat/file')
end
after(:all) do
shell('rm -rf /tmp/concat /var/lib/puppet/concat')
pp = <<-EOS
file { '#{basedir}':
ensure => directory,
}
file { '#{basedir}/file':
ensure => link,
target => '#{basedir}/dangling',
}
EOS
apply_manifest(pp)
end
pp = <<-EOS
concat { '/tmp/concat/file':
concat { '#{basedir}/file':
replace => false,
}
concat::fragment { '1':
target => '/tmp/concat/file',
target => '#{basedir}/file',
content => '1',
}
concat::fragment { '2':
target => '/tmp/concat/file',
target => '#{basedir}/file',
content => '2',
}
EOS
@ -113,11 +125,12 @@ describe 'replacement of' do
apply_manifest(pp, :catch_changes => true)
end
describe file('/tmp/concat/file') do
it { should be_linked_to '/tmp/concat/dangling' }
# XXX specinfra doesn't support be_linked_to on AIX
describe file("#{basedir}/file"), :unless => (fact("osfamily") == "AIX") do
it { should be_linked_to "#{basedir}/dangling" }
end
describe file('/tmp/concat/dangling') do
describe file("#{basedir}/dangling") do
# XXX serverspec does not have a matcher for 'exists'
it { should_not be_file }
it { should_not be_directory }
@ -129,25 +142,30 @@ describe 'replacement of' do
# when using ensure => present and source => ... but it will not when using
# ensure => present and content => ...; this is somewhat confusing behavior
before(:all) do
shell('mkdir -p /tmp/concat')
shell('ln -s /tmp/concat/dangling /tmp/concat/file')
end
after(:all) do
shell('rm -rf /tmp/concat /var/lib/puppet/concat')
pp = <<-EOS
file { '#{basedir}':
ensure => directory,
}
file { '#{basedir}/file':
ensure => link,
target => '#{basedir}/dangling',
}
EOS
apply_manifest(pp)
end
pp = <<-EOS
concat { '/tmp/concat/file':
concat { '#{basedir}/file':
replace => true,
}
concat::fragment { '1':
target => '/tmp/concat/file',
target => '#{basedir}/file',
content => '1',
}
concat::fragment { '2':
target => '/tmp/concat/file',
target => '#{basedir}/file',
content => '2',
}
EOS
@ -157,7 +175,7 @@ describe 'replacement of' do
apply_manifest(pp, :catch_changes => true)
end
describe file('/tmp/concat/file') do
describe file("#{basedir}/file") do
it { should be_file }
it { should contain '1' }
it { should contain '2' }
@ -168,22 +186,26 @@ describe 'replacement of' do
context 'directory' do
context 'should not succeed' do
before(:all) do
shell('mkdir -p /tmp/concat/file')
pp = <<-EOS
file { '#{basedir}':
ensure => directory,
}
file { '#{basedir}/file':
ensure => directory,
}
EOS
apply_manifest(pp)
end
after(:all) do
shell('rm -rf /tmp/concat /var/lib/puppet/concat')
end
pp = <<-EOS
concat { '/tmp/concat/file': }
concat { '#{basedir}/file': }
concat::fragment { '1':
target => '/tmp/concat/file',
target => '#{basedir}/file',
content => '1',
}
concat::fragment { '2':
target => '/tmp/concat/file',
target => '#{basedir}/file',
content => '2',
}
EOS
@ -193,7 +215,7 @@ describe 'replacement of' do
expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/change from directory to file failed/)
end
describe file('/tmp/concat/file') do
describe file("#{basedir}/file") do
it { should be_directory }
end
end
@ -204,25 +226,18 @@ describe 'replacement of' do
# changed, extended, or a new param introduced to control directory
# replacement.
context 'should succeed', :pending => 'not yet implemented' do
before(:all) do
shell('mkdir -p /tmp/concat/file')
end
after(:all) do
shell('rm -rf /tmp/concat /var/lib/puppet/concat')
end
pp = <<-EOS
concat { '/tmp/concat/file':
concat { '#{basedir}/file':
force => true,
}
concat::fragment { '1':
target => '/tmp/concat/file',
target => '#{basedir}/file',
content => '1',
}
concat::fragment { '2':
target => '/tmp/concat/file',
target => '#{basedir}/file',
content => '2',
}
EOS
@ -232,7 +247,7 @@ describe 'replacement of' do
apply_manifest(pp, :catch_changes => true)
end
describe file('/tmp/concat/file') do
describe file("#{basedir}/file") do
it { should be_file }
it { should contain '1' }
end

View file

@ -1,9 +1,10 @@
require 'spec_helper_acceptance'
describe 'symbolic name' do
basedir = default.tmpdir('concat')
pp = <<-EOS
concat { 'not_abs_path':
path => '/tmp/concat/file',
path => '#{basedir}/file',
}
concat::fragment { '1':
@ -24,7 +25,7 @@ describe 'symbolic name' do
apply_manifest(pp, :catch_changes => true)
end
describe file('/tmp/concat/file') do
describe file("#{basedir}/file") do
it { should be_file }
it { should contain '1' }
it { should contain '2' }

View file

@ -1,20 +1,21 @@
require 'spec_helper_acceptance'
describe 'concat warn =>' do
basedir = default.tmpdir('concat')
context 'true should enable default warning message' do
pp = <<-EOS
concat { '/tmp/concat/file':
concat { '#{basedir}/file':
warn => true,
}
concat::fragment { '1':
target => '/tmp/concat/file',
target => '#{basedir}/file',
content => '1',
order => '01',
}
concat::fragment { '2':
target => '/tmp/concat/file',
target => '#{basedir}/file',
content => '2',
order => '02',
}
@ -25,7 +26,7 @@ describe 'concat warn =>' do
apply_manifest(pp, :catch_changes => true)
end
describe file('/tmp/concat/file') do
describe file("#{basedir}/file") do
it { should be_file }
it { should contain '# This file is managed by Puppet. DO NOT EDIT.' }
it { should contain '1' }
@ -34,18 +35,18 @@ describe 'concat warn =>' do
end
context 'false should not enable default warning message' do
pp = <<-EOS
concat { '/tmp/concat/file':
concat { '#{basedir}/file':
warn => false,
}
concat::fragment { '1':
target => '/tmp/concat/file',
target => '#{basedir}/file',
content => '1',
order => '01',
}
concat::fragment { '2':
target => '/tmp/concat/file',
target => '#{basedir}/file',
content => '2',
order => '02',
}
@ -56,7 +57,7 @@ describe 'concat warn =>' do
apply_manifest(pp, :catch_changes => true)
end
describe file('/tmp/concat/file') do
describe file("#{basedir}/file") do
it { should be_file }
it { should_not contain '# This file is managed by Puppet. DO NOT EDIT.' }
it { should contain '1' }
@ -65,18 +66,18 @@ describe 'concat warn =>' do
end
context '# foo should overide default warning message' do
pp = <<-EOS
concat { '/tmp/concat/file':
concat { '#{basedir}/file':
warn => '# foo',
}
concat::fragment { '1':
target => '/tmp/concat/file',
target => '#{basedir}/file',
content => '1',
order => '01',
}
concat::fragment { '2':
target => '/tmp/concat/file',
target => '#{basedir}/file',
content => '2',
order => '02',
}
@ -87,7 +88,7 @@ describe 'concat warn =>' do
apply_manifest(pp, :catch_changes => true)
end
describe file('/tmp/concat/file') do
describe file("#{basedir}/file") do
it { should be_file }
it { should contain '# foo' }
it { should contain '1' }