diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-02-24 20:00:30 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-02-24 20:00:30 +0000 |
commit | 7e5cc76cf9afb4b18a412e6971ea5a4f4a44935e (patch) | |
tree | cf3f77daac592b55cb67176a1d0b281fceced198 | |
parent | 7806618227c4a3df1fef446e2d1307afeec53db4 (diff) | |
download | puppet-7e5cc76cf9afb4b18a412e6971ea5a4f4a44935e.tar.gz puppet-7e5cc76cf9afb4b18a412e6971ea5a4f4a44935e.tar.xz puppet-7e5cc76cf9afb4b18a412e6971ea5a4f4a44935e.zip |
Fixing package types so you can specify the package type manually in a manifest
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@937 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r-- | lib/puppet/type/package.rb | 6 | ||||
-rw-r--r-- | test/types/package.rb | 9 |
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/puppet/type/package.rb b/lib/puppet/type/package.rb index 82afb86a5..ab16cd86d 100644 --- a/lib/puppet/type/package.rb +++ b/lib/puppet/type/package.rb @@ -258,6 +258,9 @@ module Puppet # We cannot log in this routine, because this gets called before # there's a name for the package. munge do |type| + if type.is_a? String + type = type.intern + end @parent.type2module(type) end end @@ -385,6 +388,7 @@ module Puppet Puppet.notice "No support for gentoo yet" @default = nil when "debian": @default = :apt + when "centos": @default = :rpm when "fedora": @default = :yum when "redhat": @default = :rpm when "openbsd": @default = :bsd @@ -392,7 +396,7 @@ module Puppet if Facter["kernel"] == "Linux" Puppet.warning "Defaulting to RPM for %s" % Facter["operatingsystem"].value - @default = nil + @default = :rpm else Puppet.warning "No default package system for %s" % Facter["operatingsystem"].value diff --git a/test/types/package.rb b/test/types/package.rb index 08456e054..2d309b0f3 100644 --- a/test/types/package.rb +++ b/test/types/package.rb @@ -144,6 +144,15 @@ class TestPackages < Test::Unit::TestCase "Somehow retrieved unknown pkg's version") end + def test_specifypkgtype + assert_nothing_raised { + pkg = Puppet.type(:package).create( + :name => "mypkg", + :type => "yum" + ) + } + end + def test_latestpkg tstpkgs { |pkg| assert_nothing_raised { |