Revert "Undo backwards-incompatible changes and features."
This reverts commit f9e2fe2a7c
.
This commit is contained in:
parent
a2505b6e66
commit
4b8aa9e55a
5 changed files with 65 additions and 25 deletions
|
@ -2,7 +2,7 @@
|
||||||
# force a package from a specific release
|
# force a package from a specific release
|
||||||
|
|
||||||
define apt::force(
|
define apt::force(
|
||||||
$release = 'testing',
|
$release = false,
|
||||||
$version = false,
|
$version = false,
|
||||||
$timeout = 300
|
$timeout = 300
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
# ppa.pp
|
# ppa.pp
|
||||||
|
|
||||||
define apt::ppa(
|
define apt::ppa(
|
||||||
|
$ensure = 'present',
|
||||||
$release = $::lsbdistcodename,
|
$release = $::lsbdistcodename,
|
||||||
$options = '-y'
|
$options = '-y'
|
||||||
) {
|
) {
|
||||||
$ensure = 'present'
|
|
||||||
include apt::params
|
include apt::params
|
||||||
include apt::update
|
include apt::update
|
||||||
|
|
||||||
|
|
|
@ -51,12 +51,51 @@ if fact('operatingsystem') == 'Ubuntu'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'ensure' do
|
||||||
|
context 'present' do
|
||||||
|
it 'works without failure' do
|
||||||
|
pp = <<-EOS
|
||||||
|
include '::apt'
|
||||||
|
apt::ppa { 'ppa:canonical-kernel-team/ppa': ensure => present }
|
||||||
|
EOS
|
||||||
|
|
||||||
|
apply_manifest(pp, :catch_failures => true)
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'contains the source file' do
|
||||||
|
it 'contains a kernel ppa source' do
|
||||||
|
shell('ls /etc/apt/sources.list.d/canonical-kernel-team-ppa-*', :acceptable_exit_codes => [0])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'ensure' do
|
||||||
|
context 'absent' do
|
||||||
|
it 'works without failure' do
|
||||||
|
pp = <<-EOS
|
||||||
|
include '::apt'
|
||||||
|
apt::ppa { 'ppa:canonical-kernel-team/ppa': ensure => absent }
|
||||||
|
EOS
|
||||||
|
|
||||||
|
apply_manifest(pp, :catch_failures => true)
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'doesnt contain the source file' do
|
||||||
|
it 'fails' do
|
||||||
|
shell('ls /etc/apt/sources.list.d/canonical-kernel-team-ppa-*', :acceptable_exit_codes => [2])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'release' do
|
context 'release' do
|
||||||
context 'precise' do
|
context 'precise' do
|
||||||
it 'works without failure' do
|
it 'works without failure' do
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include '::apt'
|
include '::apt'
|
||||||
apt::ppa { 'ppa:canonical-kernel-team/ppa':
|
apt::ppa { 'ppa:canonical-kernel-team/ppa':
|
||||||
|
ensure => present,
|
||||||
release => precise,
|
release => precise,
|
||||||
}
|
}
|
||||||
EOS
|
EOS
|
||||||
|
@ -77,6 +116,7 @@ if fact('operatingsystem') == 'Ubuntu'
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include '::apt'
|
include '::apt'
|
||||||
apt::ppa { 'ppa:canonical-kernel-team/ppa':
|
apt::ppa { 'ppa:canonical-kernel-team/ppa':
|
||||||
|
ensure => present,
|
||||||
release => precise,
|
release => precise,
|
||||||
options => '-y',
|
options => '-y',
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ describe 'apt::force define' do
|
||||||
it 'should work with no errors' do
|
it 'should work with no errors' do
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include apt
|
include apt
|
||||||
apt::force { 'vim': release => false, }
|
apt::force { 'vim': }
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
shell('apt-get remove -y vim')
|
shell('apt-get remove -y vim')
|
||||||
|
@ -41,7 +41,7 @@ describe 'apt::force define' do
|
||||||
it 'should work with no errors' do
|
it 'should work with no errors' do
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include apt
|
include apt
|
||||||
apt::force { 'vim': version => '1.1.1', release => false, }
|
apt::force { 'vim': version => '1.1.1' }
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
shell('apt-get remove -y vim')
|
shell('apt-get remove -y vim')
|
||||||
|
@ -59,7 +59,7 @@ describe 'apt::force define' do
|
||||||
it 'should work with no errors' do
|
it 'should work with no errors' do
|
||||||
pp = <<-EOS
|
pp = <<-EOS
|
||||||
include apt
|
include apt
|
||||||
apt::force { 'vim': release => false, timeout => '1' }
|
apt::force { 'vim': timeout => '1' }
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
shell('apt-get clean')
|
shell('apt-get clean')
|
||||||
|
|
|
@ -10,7 +10,7 @@ describe 'apt::force', :type => :define do
|
||||||
|
|
||||||
let :default_params do
|
let :default_params do
|
||||||
{
|
{
|
||||||
:release => 'testing',
|
:release => false,
|
||||||
:version => false
|
:version => false
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -19,18 +19,18 @@ describe 'apt::force', :type => :define do
|
||||||
let :params do
|
let :params do
|
||||||
default_params
|
default_params
|
||||||
end
|
end
|
||||||
it { should contain_exec("/usr/bin/apt-get -y -t #{params[:release]} install #{title}").with(
|
it { should contain_exec("/usr/bin/apt-get -y install #{title}").with(
|
||||||
:unless => "/usr/bin/test \$(/usr/bin/apt-cache policy -t #{params[:release]} #{title} | /bin/grep -E 'Installed|Candidate' | /usr/bin/uniq -s 14 | /usr/bin/wc -l) -eq 1",
|
:unless => "/usr/bin/dpkg -s #{title} | grep -q 'Status: install'",
|
||||||
:timeout => '300'
|
:timeout => '300'
|
||||||
) }
|
) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "when specifying false release parameter" do
|
describe "when specifying release parameter" do
|
||||||
let :params do
|
let :params do
|
||||||
default_params.merge(:release => false)
|
default_params.merge(:release => 'testing')
|
||||||
end
|
end
|
||||||
it { should contain_exec("/usr/bin/apt-get -y install #{title}").with(
|
it { should contain_exec("/usr/bin/apt-get -y -t #{params[:release]} install #{title}").with(
|
||||||
:unless => "/usr/bin/dpkg -s #{title} | grep -q 'Status: install'"
|
:unless => "/usr/bin/test \$(/usr/bin/apt-cache policy -t #{params[:release]} #{title} | /bin/grep -E 'Installed|Candidate' | /usr/bin/uniq -s 14 | /usr/bin/wc -l) -eq 1"
|
||||||
) }
|
) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -38,20 +38,20 @@ describe 'apt::force', :type => :define do
|
||||||
let :params do
|
let :params do
|
||||||
default_params.merge(:version => '1')
|
default_params.merge(:version => '1')
|
||||||
end
|
end
|
||||||
it { should contain_exec("/usr/bin/apt-get -y -t #{params[:release]} install #{title}=#{params[:version]}").with(
|
it { should contain_exec("/usr/bin/apt-get -y install #{title}=#{params[:version]}").with(
|
||||||
:unless => "/usr/bin/apt-cache policy -t #{params[:release]} #{title} | /bin/grep -q 'Installed: #{params[:version]}'"
|
|
||||||
) }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "when specifying false release and version parameters" do
|
|
||||||
let :params do
|
|
||||||
default_params.merge(
|
|
||||||
:release => false,
|
|
||||||
:version => '1'
|
|
||||||
)
|
|
||||||
end
|
|
||||||
it { should contain_exec("/usr/bin/apt-get -y install #{title}=1").with(
|
|
||||||
:unless => "/usr/bin/dpkg -s #{title} | grep -q 'Version: #{params[:version]}'"
|
:unless => "/usr/bin/dpkg -s #{title} | grep -q 'Version: #{params[:version]}'"
|
||||||
) }
|
) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "when specifying release and version parameters" do
|
||||||
|
let :params do
|
||||||
|
default_params.merge(
|
||||||
|
:release => 'testing',
|
||||||
|
:version => '1'
|
||||||
|
)
|
||||||
|
end
|
||||||
|
it { should contain_exec("/usr/bin/apt-get -y -t #{params[:release]} install #{title}=1").with(
|
||||||
|
:unless => "/usr/bin/apt-cache policy -t #{params[:release]} #{title} | /bin/grep -q 'Installed: #{params[:version]}'"
|
||||||
|
) }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue