]> review.fuel-infra Code Review - puppet-modules/puppetlabs-apt.git/commitdiff
Undo backwards-incompatible changes and features.
authorHunter Haugen <hunter@puppetlabs.com>
Fri, 14 Feb 2014 22:33:30 +0000 (14:33 -0800)
committerHunter Haugen <hunter@puppetlabs.com>
Fri, 14 Feb 2014 22:33:30 +0000 (14:33 -0800)
Undoes the parameter changes in #140 and #184

manifests/force.pp
manifests/ppa.pp
spec/acceptance/apt_ppa_spec.rb
spec/acceptance/force_spec.rb
spec/defines/force_spec.rb

index 152bb67354db6fa8960a20a942329f0cf5d7b147..70b7d47239b29a362428f12afafac3fb5d53a20f 100644 (file)
@@ -2,7 +2,7 @@
 # force a package from a specific release
 
 define apt::force(
-  $release = false,
+  $release = 'testing',
   $version = false,
   $timeout = 300
 ) {
index 14fbbceba41089f3e7ee683724c748c8c65c5941..caff436bdf542c7fbaa23a5752ef81feb7912158 100644 (file)
@@ -1,10 +1,10 @@
 # ppa.pp
 
 define apt::ppa(
-  $ensure  = 'present',
   $release = $::lsbdistcodename,
   $options = '-y'
 ) {
+  $ensure  = 'present'
   include apt::params
   include apt::update
 
index c0d216107de96913cebfaae9de713df8eff30958..2b156bc53288138df583c5ab292b09bc6a82a644 100644 (file)
@@ -51,51 +51,12 @@ if fact('operatingsystem') == 'Ubuntu'
       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 'precise' do
         it 'works without failure' do
           pp = <<-EOS
           include '::apt'
           apt::ppa { 'ppa:canonical-kernel-team/ppa':
-            ensure  => present,
             release => precise,
           }
           EOS
@@ -116,7 +77,6 @@ if fact('operatingsystem') == 'Ubuntu'
           pp = <<-EOS
           include '::apt'
           apt::ppa { 'ppa:canonical-kernel-team/ppa':
-            ensure  => present,
             release => precise,
             options => '-y',
           }
index c364d5fe157fdb05ea4b7e2fa6ff235841e3ee8d..aab77a1a766497fd9ad702f71ffa57aadfe73023 100644 (file)
@@ -7,7 +7,7 @@ describe 'apt::force define' do
     it 'should work with no errors' do
       pp = <<-EOS
       include apt
-      apt::force { 'vim': }
+      apt::force { 'vim': release => false, }
       EOS
 
       shell('apt-get remove -y vim')
@@ -41,7 +41,7 @@ describe 'apt::force define' do
     it 'should work with no errors' do
       pp = <<-EOS
       include apt
-      apt::force { 'vim': version => '1.1.1' }
+      apt::force { 'vim': version => '1.1.1', release => false, }
       EOS
 
       shell('apt-get remove -y vim')
@@ -59,7 +59,7 @@ describe 'apt::force define' do
     it 'should work with no errors' do
       pp = <<-EOS
       include apt
-      apt::force { 'vim': timeout => '1' }
+      apt::force { 'vim': release => false, timeout => '1' }
       EOS
 
       shell('apt-get clean')
index 84231fa233b1082f42132f618680f95e767c78a8..829ec4748f788999d34d291e25ab890b7b847139 100644 (file)
@@ -10,7 +10,7 @@ describe 'apt::force', :type => :define do
 
   let :default_params do
     {
-      :release => false,
+      :release => 'testing',
       :version => false
     }
   end
@@ -19,18 +19,18 @@ describe 'apt::force', :type => :define do
     let :params do
       default_params
     end
-    it { should contain_exec("/usr/bin/apt-get -y  install #{title}").with(
-      :unless  => "/usr/bin/dpkg -s #{title} | grep -q 'Status: install'",
+    it { should contain_exec("/usr/bin/apt-get -y -t #{params[:release]} 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",
       :timeout => '300'
     ) }
   end
 
-  describe "when specifying release parameter" do
+  describe "when specifying false release parameter" do
     let :params do
-      default_params.merge(:release => 'testing')
+      default_params.merge(:release => false)
     end
-    it { should contain_exec("/usr/bin/apt-get -y -t #{params[:release]} 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"
+    it { should contain_exec("/usr/bin/apt-get -y  install #{title}").with(
+      :unless  => "/usr/bin/dpkg -s #{title} | grep -q 'Status: install'"
     ) }
   end
 
@@ -38,20 +38,20 @@ describe 'apt::force', :type => :define do
     let :params do
       default_params.merge(:version => '1')
     end
-    it { should contain_exec("/usr/bin/apt-get -y  install #{title}=#{params[:version]}").with(
-      :unless => "/usr/bin/dpkg -s #{title} | grep -q 'Version: #{params[:version]}'"
+    it { should contain_exec("/usr/bin/apt-get -y -t #{params[:release]} 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 release and version parameters" do
+  describe "when specifying false release and version parameters" do
     let :params do
       default_params.merge(
-        :release => 'testing',
+        :release => false,
         :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]}'"
+    it { should contain_exec("/usr/bin/apt-get -y  install #{title}=1").with(
+      :unless => "/usr/bin/dpkg -s #{title} | grep -q 'Version: #{params[:version]}'"
     ) }
   end
 end