This work flips from onlyif to unless (mistakenly looked at the

wrong return code).
This commit is contained in:
Ashley Penney 2013-10-08 10:50:30 -07:00
parent e3907061fd
commit 39cbeeb9d2
3 changed files with 4 additions and 16 deletions

View file

@ -42,7 +42,7 @@ define apt::ppa(
exec { "add-apt-repository-${name}": exec { "add-apt-repository-${name}":
environment => $proxy_env, environment => $proxy_env,
command => "/usr/bin/add-apt-repository ${options} ${name}", command => "/usr/bin/add-apt-repository ${options} ${name}",
onlyif => "/usr/bin/test -s ${sources_list_d}/${sources_list_d_filename}", unless => "/usr/bin/test -s ${sources_list_d}/${sources_list_d_filename}",
logoutput => 'on_failure', logoutput => 'on_failure',
notify => Exec['apt_update'], notify => Exec['apt_update'],
require => [ require => [

View file

@ -45,7 +45,7 @@ describe 'apt::ppa', :type => :define do
it { should contain_exec("add-apt-repository-#{t}").with( it { should contain_exec("add-apt-repository-#{t}").with(
'command' => "/usr/bin/add-apt-repository #{options} #{t}", 'command' => "/usr/bin/add-apt-repository #{options} #{t}",
'onlyif' => "/usr/bin/test -s /etc/apt/sources.list.d/#{filename}", 'unless' => "/usr/bin/test -s /etc/apt/sources.list.d/#{filename}",
'require' => ["File[/etc/apt/sources.list.d]", "Package[#{package}]"], 'require' => ["File[/etc/apt/sources.list.d]", "Package[#{package}]"],
'notify' => "Exec[apt_update]" 'notify' => "Exec[apt_update]"
) )
@ -74,7 +74,7 @@ describe 'apt::ppa', :type => :define do
it { should contain_exec("add-apt-repository-#{title}").with( it { should contain_exec("add-apt-repository-#{title}").with(
'environment' => [], 'environment' => [],
'command' => "/usr/bin/add-apt-repository #{options} #{title}", 'command' => "/usr/bin/add-apt-repository #{options} #{title}",
'onlyif' => "/usr/bin/test -s /etc/apt/sources.list.d/#{filename}", 'unless' => "/usr/bin/test -s /etc/apt/sources.list.d/#{filename}",
'require' => ["File[/etc/apt/sources.list.d]", "Package[#{package}]"], 'require' => ["File[/etc/apt/sources.list.d]", "Package[#{package}]"],
'notify' => "Exec[apt_update]" 'notify' => "Exec[apt_update]"
) )
@ -100,7 +100,7 @@ describe 'apt::ppa', :type => :define do
"https_proxy=http://user:pass@proxy:8080", "https_proxy=http://user:pass@proxy:8080",
], ],
'command' => "/usr/bin/add-apt-repository #{options} #{title}", 'command' => "/usr/bin/add-apt-repository #{options} #{title}",
'onlyif' => "/usr/bin/test -s /etc/apt/sources.list.d/#{filename}", 'unless' => "/usr/bin/test -s /etc/apt/sources.list.d/#{filename}",
'require' => ["File[/etc/apt/sources.list.d]", "Package[#{package}]"], 'require' => ["File[/etc/apt/sources.list.d]", "Package[#{package}]"],
'notify' => "Exec[apt_update]" 'notify' => "Exec[apt_update]"
) )

View file

@ -8,15 +8,3 @@ describe 'basic tests:' do
its(:exit_code) { should be_zero } its(:exit_code) { should be_zero }
end end
end end
describe 'disable selinux:' do
context puppet_apply '
exec { "setenforce 0":
path => "/bin:/sbin:/usr/bin:/usr/sbin",
onlyif => "which setenforce && getenforce | grep Enforcing",
}
' do
its(:stderr) { should be_empty }
its(:exit_code) { should_not == 1 }
end
end