]> review.fuel-infra Code Review - puppet-modules/puppetlabs-apt.git/commitdiff
Merge pull request #23 from haus/python_properties
authorRyan Coleman <ryan@puppetlabs.com>
Fri, 24 Feb 2012 19:20:52 +0000 (11:20 -0800)
committerRyan Coleman <ryan@puppetlabs.com>
Fri, 24 Feb 2012 19:20:52 +0000 (11:20 -0800)
Check if python-software-properties is defined before attempting to define it.

Reviewed and tested by Ryan Coleman (ryan@puppetlabs.com)

manifests/init.pp
spec/classes/apt_spec.rb

index ceb8d5ce0bffb38a7bf1bf2fc6b74033819ae25f..b41d359fbdeb22652a42db531ea387cf9abf05cb 100644 (file)
@@ -37,7 +37,9 @@ class apt(
     false => true
   }
 
-  package { "python-software-properties": }
+  if ! defined(Package["python-software-properties"]) {
+    package { "python-software-properties": }
+  }
 
   file { "sources.list":
     path => "${apt::params::root}/sources.list",
index 6ab1e9e6d64de8186d01b4585dbe0aaeb8bc7ea1..71a438e0627780794fdfb47f1fbad687d6ab3fe4 100644 (file)
@@ -126,4 +126,9 @@ describe 'apt', :type => :class do
       end
     end
   end
+
+  describe "it should not error if package['python-software-properties'] is already defined" do
+    let(:pre_condition) { 'package { "python-software-properties": }->Class["Apt"]' }
+    it { should contain_package("python-software-properties") }
+  end
 end