Преглед изворни кода

Merge pull request #23 from haus/python_properties

Check if python-software-properties is defined before attempting to define it.

Reviewed and tested by Ryan Coleman (ryan@puppetlabs.com)
Ryan Coleman пре 12 година
родитељ
комит
b1eb28956e
2 измењених фајлова са 8 додато и 1 уклоњено
  1. 3 1
      manifests/init.pp
  2. 5 0
      spec/classes/apt_spec.rb

+ 3 - 1
manifests/init.pp

@@ -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",

+ 5 - 0
spec/classes/apt_spec.rb

@@ -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