Cherry-pick fix from puppetlabs-concat
sha1: 820bc092f443bcf540240d8d2a2081e75b3145b7 Concat 1.1.0 has idempotancy issue with `ensure => 'absent'` Bug described at https://tickets.puppetlabs.com/browse/MODULES-1311 Fix fixtures for tests as 10.108.0.2 is not available during the tests Change-Id: I900980647d865d2712c823d04481ecebe91e9a0c Partial-Bug: 1455389 Signed-off-by: Sergii Golovatiuk <sgolovatiuk@mirantis.com>
This commit is contained in:
parent
1645fe45f2
commit
31a362eef7
|
@ -221,10 +221,12 @@ define concat(
|
|||
default => '/bin:/usr/bin',
|
||||
}
|
||||
|
||||
# Need to have an unless here for idempotency.
|
||||
exec { "concat_${name}":
|
||||
alias => "concat_${fragdir}",
|
||||
command => $absent_exec_command,
|
||||
path => $absent_exec_path
|
||||
unless => $absent_exec_command,
|
||||
path => $absent_exec_path,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,10 +19,10 @@ class concat::setup {
|
|||
} else {
|
||||
fail ('$concat_basedir not defined. Try running again with pluginsync=true on the [master] and/or [main] section of your node\'s \'/etc/puppet/puppet.conf\'.')
|
||||
}
|
||||
|
||||
|
||||
# owner and mode of fragment files (on windows owner and access rights should be inherited from concatdir and not explicitly set to avoid problems)
|
||||
$fragment_owner = $osfamily ? { 'windows' => undef, default => $::id }
|
||||
$fragment_mode = $osfamily ? { 'windows' => undef, default => '0640' }
|
||||
$fragment_owner = $::osfamily ? { 'windows' => undef, default => $::id }
|
||||
$fragment_mode = $::osfamily ? { 'windows' => undef, default => '0640' }
|
||||
|
||||
$script_name = $::kernel ? {
|
||||
'windows' => 'concatfragments.rb',
|
||||
|
@ -31,9 +31,9 @@ class concat::setup {
|
|||
|
||||
$script_path = "${concatdir}/bin/${script_name}"
|
||||
|
||||
$script_owner = $osfamily ? { 'windows' => undef, default => $::id }
|
||||
$script_owner = $::osfamily ? { 'windows' => undef, default => $::id }
|
||||
|
||||
$script_mode = $osfamily ? { 'windows' => undef, default => '0755' }
|
||||
$script_mode = $::osfamily ? { 'windows' => undef, default => '0755' }
|
||||
|
||||
$script_command = $::kernel ? {
|
||||
'windows' => "ruby.exe ${script_path}",
|
||||
|
|
|
@ -36,7 +36,7 @@ describe 'concat::setup', :type => :class do
|
|||
|
||||
context 'deprecated as a public class' do
|
||||
it 'should create a warning' do
|
||||
pending('rspec-puppet support for testing warning()')
|
||||
skip('rspec-puppet support for testing warning()')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -18,7 +18,7 @@ describe 'concat::fragment', :type => :define do
|
|||
fragdir = "#{concatdir}/#{safe_target_name}"
|
||||
id = 'root'
|
||||
if p[:ensure] == 'absent'
|
||||
safe_ensure = p[:ensure]
|
||||
safe_ensure = p[:ensure]
|
||||
else
|
||||
safe_ensure = 'file'
|
||||
end
|
||||
|
@ -68,7 +68,7 @@ describe 'concat::fragment', :type => :define do
|
|||
let(:params) {{ :target => false }}
|
||||
|
||||
it 'should fail' do
|
||||
expect { should }.to raise_error(Puppet::Error, /is not a string/)
|
||||
should compile.and_raise_error(/is not a string/)
|
||||
end
|
||||
end
|
||||
end # target =>
|
||||
|
@ -89,7 +89,7 @@ describe 'concat::fragment', :type => :define do
|
|||
let(:params) {{ :ensure => 'invalid', :target => '/etc/motd' }}
|
||||
|
||||
it 'should create a warning' do
|
||||
pending('rspec-puppet support for testing warning()')
|
||||
skip('rspec-puppet support for testing warning()')
|
||||
end
|
||||
end
|
||||
end # ensure =>
|
||||
|
@ -110,7 +110,7 @@ describe 'concat::fragment', :type => :define do
|
|||
let(:params) {{ :content => false, :target => '/etc/motd' }}
|
||||
|
||||
it 'should fail' do
|
||||
expect { should }.to raise_error(Puppet::Error, /is not a string/)
|
||||
should compile.and_raise_error(/is not a string/)
|
||||
end
|
||||
end
|
||||
end # content =>
|
||||
|
@ -131,7 +131,7 @@ describe 'concat::fragment', :type => :define do
|
|||
let(:params) {{ :source => false, :target => '/etc/motd' }}
|
||||
|
||||
it 'should fail' do
|
||||
expect { should }.to raise_error(Puppet::Error, /is not a string or an Array/)
|
||||
should compile.and_raise_error(/is not a string or an Array/)
|
||||
end
|
||||
end
|
||||
end # source =>
|
||||
|
@ -152,7 +152,7 @@ describe 'concat::fragment', :type => :define do
|
|||
let(:params) {{ :order => false, :target => '/etc/motd' }}
|
||||
|
||||
it 'should fail' do
|
||||
expect { should }.to raise_error(Puppet::Error, /is not a string/)
|
||||
should compile.and_raise_error(/is not a string/)
|
||||
end
|
||||
end
|
||||
end # order =>
|
||||
|
@ -172,7 +172,7 @@ describe 'concat::fragment', :type => :define do
|
|||
end
|
||||
|
||||
it 'should fail' do
|
||||
expect { should }.to raise_error(Puppet::Error, /#{Regexp.escape(error_msg)}/m)
|
||||
should compile.and_raise_error(/#{Regexp.escape(error_msg)}/m)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -188,7 +188,7 @@ describe 'concat::fragment', :type => :define do
|
|||
end
|
||||
|
||||
it 'should fail' do
|
||||
expect { should }.to raise_error(Puppet::Error, /#{Regexp.escape(error_msg)}/m)
|
||||
should compile.and_raise_error(/#{Regexp.escape(error_msg)}/m)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -204,7 +204,7 @@ describe 'concat::fragment', :type => :define do
|
|||
end
|
||||
|
||||
it 'should fail' do
|
||||
expect { should }.to raise_error(Puppet::Error, /#{Regexp.escape(error_msg)}/m)
|
||||
should compile.and_raise_error(/#{Regexp.escape(error_msg)}/m)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -219,7 +219,7 @@ describe 'concat::fragment', :type => :define do
|
|||
}
|
||||
|
||||
it 'should create a warning' do
|
||||
pending('rspec-puppet support for testing warning()')
|
||||
skip('rspec-puppet support for testing warning()')
|
||||
end
|
||||
end
|
||||
end # mode =>
|
||||
|
@ -232,7 +232,7 @@ describe 'concat::fragment', :type => :define do
|
|||
}
|
||||
|
||||
it 'should create a warning' do
|
||||
pending('rspec-puppet support for testing warning()')
|
||||
skip('rspec-puppet support for testing warning()')
|
||||
end
|
||||
end
|
||||
end # owner =>
|
||||
|
@ -245,7 +245,7 @@ describe 'concat::fragment', :type => :define do
|
|||
}
|
||||
|
||||
it 'should create a warning' do
|
||||
pending('rspec-puppet support for testing warning()')
|
||||
skip('rspec-puppet support for testing warning()')
|
||||
end
|
||||
end
|
||||
end # group =>
|
||||
|
@ -258,7 +258,7 @@ describe 'concat::fragment', :type => :define do
|
|||
}
|
||||
|
||||
it 'should create a warning' do
|
||||
pending('rspec-puppet support for testing warning()')
|
||||
skip('rspec-puppet support for testing warning()')
|
||||
end
|
||||
end
|
||||
end # backup =>
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
|||
|
||||
describe 'concat', :type => :define do
|
||||
|
||||
shared_examples 'concat' do |title, params, id|
|
||||
shared_examples 'concat' do |title, params, id|
|
||||
params = {} if params.nil?
|
||||
id = 'root' if id.nil?
|
||||
|
||||
|
@ -84,7 +84,7 @@ describe 'concat', :type => :define do
|
|||
"-o \"#{concatdir}/#{safe_name}/fragments.concat.out\" " +
|
||||
"-d \"#{concatdir}/#{safe_name}\""
|
||||
|
||||
# flag order: fragdir, warnflag, forceflag, orderflag, newlineflag
|
||||
# flag order: fragdir, warnflag, forceflag, orderflag, newlineflag
|
||||
if p.has_key?(:warn)
|
||||
case p[:warn]
|
||||
when TrueClass
|
||||
|
@ -144,6 +144,7 @@ describe 'concat', :type => :define do
|
|||
should contain_exec("concat_#{title}").with({
|
||||
:alias => "concat_#{fragdir}",
|
||||
:command => 'true',
|
||||
:unless => 'true',
|
||||
:path => '/bin:/usr/bin',
|
||||
})
|
||||
end
|
||||
|
@ -164,7 +165,7 @@ describe 'concat', :type => :define do
|
|||
context title do
|
||||
let(:title) { title }
|
||||
it 'should fail' do
|
||||
expect { should }.to raise_error(Puppet::Error, /is not an absolute path/)
|
||||
should compile.and_raise_error(/is not an absolute path/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -194,7 +195,7 @@ describe 'concat', :type => :define do
|
|||
let(:title) { '/etc/foo.bar' }
|
||||
let(:params) {{ :ensure => 'invalid' }}
|
||||
it 'should fail' do
|
||||
expect { should }.to raise_error(Puppet::Error, /#{Regexp.escape('does not match "^present$|^absent$"')}/)
|
||||
should compile.and_raise_error(/#{Regexp.escape('does not match "^present$|^absent$"')}/)
|
||||
end
|
||||
end
|
||||
end # ensure =>
|
||||
|
@ -209,7 +210,7 @@ describe 'concat', :type => :define do
|
|||
let(:title) { '/etc/foo.bar' }
|
||||
let(:params) {{ :path => path }}
|
||||
it 'should fail' do
|
||||
expect { should }.to raise_error(Puppet::Error, /is not an absolute path/)
|
||||
should compile.and_raise_error(/is not an absolute path/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -224,7 +225,7 @@ describe 'concat', :type => :define do
|
|||
let(:title) { '/etc/foo.bar' }
|
||||
let(:params) {{ :owner => false }}
|
||||
it 'should fail' do
|
||||
expect { should }.to raise_error(Puppet::Error, /is not a string/)
|
||||
should compile.and_raise_error(/is not a string/)
|
||||
end
|
||||
end
|
||||
end # owner =>
|
||||
|
@ -238,7 +239,7 @@ describe 'concat', :type => :define do
|
|||
let(:title) { '/etc/foo.bar' }
|
||||
let(:params) {{ :group => false }}
|
||||
it 'should fail' do
|
||||
expect { should }.to raise_error(Puppet::Error, /is not a string/)
|
||||
should compile.and_raise_error(/is not a string/)
|
||||
end
|
||||
end
|
||||
end # group =>
|
||||
|
@ -252,7 +253,7 @@ describe 'concat', :type => :define do
|
|||
let(:title) { '/etc/foo.bar' }
|
||||
let(:params) {{ :mode => false }}
|
||||
it 'should fail' do
|
||||
expect { should }.to raise_error(Puppet::Error, /is not a string/)
|
||||
should compile.and_raise_error(/is not a string/)
|
||||
end
|
||||
end
|
||||
end # mode =>
|
||||
|
@ -270,7 +271,7 @@ describe 'concat', :type => :define do
|
|||
it_behaves_like 'concat', '/etc/foo.bar', { :warn => warn }
|
||||
|
||||
it 'should create a warning' do
|
||||
pending('rspec-puppet support for testing warning()')
|
||||
skip('rspec-puppet support for testing warning()')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -280,7 +281,7 @@ describe 'concat', :type => :define do
|
|||
let(:title) { '/etc/foo.bar' }
|
||||
let(:params) {{ :warn => 123 }}
|
||||
it 'should fail' do
|
||||
expect { should }.to raise_error(Puppet::Error, /is not a string or boolean/)
|
||||
should compile.and_raise_error(/is not a string or boolean/)
|
||||
end
|
||||
end
|
||||
end # warn =>
|
||||
|
@ -296,7 +297,7 @@ describe 'concat', :type => :define do
|
|||
let(:title) { '/etc/foo.bar' }
|
||||
let(:params) {{ :force => 123 }}
|
||||
it 'should fail' do
|
||||
expect { should }.to raise_error(Puppet::Error, /is not a boolean/)
|
||||
should compile.and_raise_error(/is not a boolean/)
|
||||
end
|
||||
end
|
||||
end # force =>
|
||||
|
@ -310,7 +311,7 @@ describe 'concat', :type => :define do
|
|||
let(:title) { '/etc/foo.bar' }
|
||||
let(:params) {{ :backup => false }}
|
||||
it 'should fail' do
|
||||
expect { should }.to raise_error(Puppet::Error, /is not a string/)
|
||||
should compile.and_raise_error(/is not a string/)
|
||||
end
|
||||
end
|
||||
end # backup =>
|
||||
|
@ -326,7 +327,7 @@ describe 'concat', :type => :define do
|
|||
let(:title) { '/etc/foo.bar' }
|
||||
let(:params) {{ :replace => 123 }}
|
||||
it 'should fail' do
|
||||
expect { should }.to raise_error(Puppet::Error, /is not a boolean/)
|
||||
should compile.and_raise_error(/is not a boolean/)
|
||||
end
|
||||
end
|
||||
end # replace =>
|
||||
|
@ -342,7 +343,7 @@ describe 'concat', :type => :define do
|
|||
let(:title) { '/etc/foo.bar' }
|
||||
let(:params) {{ :order => 'invalid' }}
|
||||
it 'should fail' do
|
||||
expect { should }.to raise_error(Puppet::Error, /#{Regexp.escape('does not match "^alpha$|^numeric$"')}/)
|
||||
should compile.and_raise_error(/#{Regexp.escape('does not match "^alpha$|^numeric$"')}/)
|
||||
end
|
||||
end
|
||||
end # order =>
|
||||
|
@ -358,7 +359,7 @@ describe 'concat', :type => :define do
|
|||
let(:title) { '/etc/foo.bar' }
|
||||
let(:params) {{ :ensure_newline => 123 }}
|
||||
it 'should fail' do
|
||||
expect { should }.to raise_error(Puppet::Error, /is not a boolean/)
|
||||
should compile.and_raise_error(/is not a boolean/)
|
||||
end
|
||||
end
|
||||
end # ensure_newline =>
|
||||
|
@ -369,7 +370,7 @@ describe 'concat', :type => :define do
|
|||
it_behaves_like 'concat', '/etc/foo.bar', { :gnu => 'foo'}
|
||||
|
||||
it 'should create a warning' do
|
||||
pending('rspec-puppet support for testing warning()')
|
||||
skip('rspec-puppet support for testing warning()')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -360,7 +360,7 @@ repo_setup:
|
|||
section: main restricted
|
||||
suite: mos6.1
|
||||
type: deb
|
||||
uri: http://10.108.0.2:8080/2014.2-6.1/ubuntu/x86_64
|
||||
uri: http://mirror.fuel-infra.org/mos/ubuntu/
|
||||
- name: mos-updates
|
||||
priority: 1050
|
||||
section: main restricted
|
||||
|
|
|
@ -360,7 +360,7 @@ repo_setup:
|
|||
section: main restricted
|
||||
suite: mos6.1
|
||||
type: deb
|
||||
uri: http://10.108.0.2:8080/2014.2-6.1/ubuntu/x86_64
|
||||
uri: http://mirror.fuel-infra.org/mos/ubuntu/
|
||||
- name: mos-updates
|
||||
priority: 1050
|
||||
section: main restricted
|
||||
|
|
|
@ -383,7 +383,7 @@ repo_setup:
|
|||
section: main restricted
|
||||
suite: mos6.1
|
||||
type: deb
|
||||
uri: http://10.108.0.2:8080/2014.2-6.1/ubuntu/x86_64
|
||||
uri: http://mirror.fuel-infra.org/mos/ubuntu/
|
||||
- name: mos-updates
|
||||
priority: 1050
|
||||
section: main restricted
|
||||
|
|
|
@ -383,7 +383,7 @@ repo_setup:
|
|||
section: main restricted
|
||||
suite: mos6.1
|
||||
type: deb
|
||||
uri: http://10.108.0.2:8080/2014.2-6.1/ubuntu/x86_64
|
||||
uri: http://mirror.fuel-infra.org/mos/ubuntu/
|
||||
- name: mos-updates
|
||||
priority: 1050
|
||||
section: main restricted
|
||||
|
|
|
@ -372,7 +372,7 @@ repo_setup:
|
|||
section: main restricted
|
||||
suite: mos6.1
|
||||
type: deb
|
||||
uri: http://10.108.0.2:8080/2014.2-6.1/ubuntu/x86_64
|
||||
uri: http://mirror.fuel-infra.org/mos/ubuntu/
|
||||
- name: mos-updates
|
||||
priority: 1050
|
||||
section: main restricted
|
||||
|
|
|
@ -372,7 +372,7 @@ repo_setup:
|
|||
section: main restricted
|
||||
suite: mos6.1
|
||||
type: deb
|
||||
uri: http://10.108.0.2:8080/2014.2-6.1/ubuntu/x86_64
|
||||
uri: http://mirror.fuel-infra.org/mos/ubuntu/
|
||||
- name: mos-updates
|
||||
priority: 1050
|
||||
section: main restricted
|
||||
|
|
|
@ -395,7 +395,7 @@ repo_setup:
|
|||
section: main restricted
|
||||
suite: mos6.1
|
||||
type: deb
|
||||
uri: http://10.108.0.2:8080/2014.2-6.1/ubuntu/x86_64
|
||||
uri: http://mirror.fuel-infra.org/mos/ubuntu/
|
||||
- name: mos-updates
|
||||
priority: 1050
|
||||
section: main restricted
|
||||
|
|
|
@ -372,7 +372,7 @@ repo_setup:
|
|||
section: main restricted
|
||||
suite: mos6.1
|
||||
type: deb
|
||||
uri: http://10.108.0.2:8080/2014.2-6.1/ubuntu/x86_64
|
||||
uri: http://mirror.fuel-infra.org/mos/ubuntu/
|
||||
- name: mos-updates
|
||||
priority: 1050
|
||||
section: main restricted
|
||||
|
|
|
@ -313,7 +313,7 @@ repo_setup:
|
|||
section: main restricted
|
||||
suite: mos6.1
|
||||
type: deb
|
||||
uri: http://10.108.0.2:8080/2014.2-6.1/ubuntu/x86_64
|
||||
uri: http://mirror.fuel-infra.org/mos/ubuntu/
|
||||
- name: mos-updates
|
||||
priority: 1050
|
||||
section: main restricted
|
||||
|
|
|
@ -313,7 +313,7 @@ repo_setup:
|
|||
section: main restricted
|
||||
suite: mos6.1
|
||||
type: deb
|
||||
uri: http://10.108.0.2:8080/2014.2-6.1/ubuntu/x86_64
|
||||
uri: http://mirror.fuel-infra.org/mos/ubuntu/
|
||||
- name: mos-updates
|
||||
priority: 1050
|
||||
section: main restricted
|
||||
|
|
|
@ -313,7 +313,7 @@ repo_setup:
|
|||
section: main restricted
|
||||
suite: mos6.1
|
||||
type: deb
|
||||
uri: http://10.108.0.2:8080/2014.2-6.1/ubuntu/x86_64
|
||||
uri: http://mirror.fuel-infra.org/mos/ubuntu/
|
||||
- name: mos-updates
|
||||
priority: 1050
|
||||
section: main restricted
|
||||
|
|
|
@ -513,7 +513,7 @@ repo_setup:
|
|||
- priority: 20
|
||||
type: rpm
|
||||
name: MOS
|
||||
uri: http://10.108.0.2:8080/2014.2-6.1/centos/x86_64
|
||||
uri: http://mirror.fuel-infra.org/fwm/6.1/centos/os/x86_64
|
||||
metadata:
|
||||
restrictions:
|
||||
- action: hide
|
||||
|
|
|
@ -523,7 +523,7 @@ repo_setup:
|
|||
- priority: 20
|
||||
type: rpm
|
||||
name: MOS
|
||||
uri: http://10.108.0.2:8080/2014.2-6.1/centos/x86_64
|
||||
uri: http://mirror.fuel-infra.org/fwm/6.1/centos/os/x86_64
|
||||
metadata:
|
||||
restrictions:
|
||||
- action: hide
|
||||
|
|
|
@ -523,7 +523,7 @@ repo_setup:
|
|||
- priority: 20
|
||||
type: rpm
|
||||
name: MOS
|
||||
uri: http://10.108.0.2:8080/2014.2-6.1/centos/x86_64
|
||||
uri: http://mirror.fuel-infra.org/fwm/6.1/centos/os/x86_64
|
||||
metadata:
|
||||
restrictions:
|
||||
- action: hide
|
||||
|
|
|
@ -523,7 +523,7 @@ repo_setup:
|
|||
- priority: 20
|
||||
type: rpm
|
||||
name: MOS
|
||||
uri: http://10.108.0.2:8080/2014.2-6.1/centos/x86_64
|
||||
uri: http://mirror.fuel-infra.org/fwm/6.1/centos/os/x86_64
|
||||
metadata:
|
||||
restrictions:
|
||||
- action: hide
|
||||
|
|
|
@ -512,7 +512,7 @@ repo_setup:
|
|||
- priority: 20
|
||||
type: rpm
|
||||
name: MOS
|
||||
uri: http://10.108.0.2:8080/2014.2-6.1/centos/x86_64
|
||||
uri: http://mirror.fuel-infra.org/fwm/6.1/centos/os/x86_64
|
||||
metadata:
|
||||
restrictions:
|
||||
- action: hide
|
||||
|
|
|
@ -523,7 +523,7 @@ repo_setup:
|
|||
- priority: 20
|
||||
type: rpm
|
||||
name: MOS
|
||||
uri: http://10.108.0.2:8080/2014.2-6.1/centos/x86_64
|
||||
uri: http://mirror.fuel-infra.org/fwm/6.1/centos/os/x86_64
|
||||
metadata:
|
||||
restrictions:
|
||||
- action: hide
|
||||
|
|
|
@ -9,13 +9,7 @@ describe manifest do
|
|||
let (:interfaces) { interfaces }
|
||||
let (:vip_interfaces) { vip_interfaces }
|
||||
|
||||
it do
|
||||
expect(subject).to contain_file('ns-ipaddr2-ocf').with(
|
||||
:path => '/usr/lib/ocf/resource.d/fuel/ns_IPaddr2',
|
||||
)
|
||||
end
|
||||
|
||||
vip_interfaces.each do |interface|
|
||||
vip_interfaces.each do |interface|
|
||||
it do
|
||||
expect(subject).to contain_cs_resource(interface).with(
|
||||
:ensure => 'present',
|
||||
|
|
Loading…
Reference in New Issue