diff options
| author | Luke Kanies <luke@madstop.com> | 2005-07-22 05:51:36 +0000 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2005-07-22 05:51:36 +0000 |
| commit | cc67845bebd79989a0cb0fe27124f244993d2233 (patch) | |
| tree | 715c609b114465f16544ab80021c01215547e3db /lib/puppet | |
| parent | 326b4ade1a41f6c876ecc9d5a291c309776c6a10 (diff) | |
| download | puppet-cc67845bebd79989a0cb0fe27124f244993d2233.tar.gz puppet-cc67845bebd79989a0cb0fe27124f244993d2233.tar.xz puppet-cc67845bebd79989a0cb0fe27124f244993d2233.zip | |
fixing package listing
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@438 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet')
| -rw-r--r-- | lib/puppet/type/package.rb | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/puppet/type/package.rb b/lib/puppet/type/package.rb index b1a544baf..60254ef50 100644 --- a/lib/puppet/type/package.rb +++ b/lib/puppet/type/package.rb @@ -111,6 +111,7 @@ module Puppet def Package.installedpkg(hash) # this is from code, so we don't have to do as much checking name = hash[:name] + hash.delete(:name) # if it already exists, modify the existing one if object = Package[name] @@ -130,7 +131,7 @@ module Puppet [var,object[var],name,value] end - object[var] = value + object.state(var).is = value # swap the values if we're a state if states.include?(var) @@ -147,10 +148,26 @@ module Puppet } return object else # just create it - return self.new(hash) + obj = self.new(:name => name) + hash.each { |var,value| + obj.addis(var,value) + } + return obj end end + def addis(state,value) + if stateklass = self.class.validstate?(state) + @states[state] = stateklass.new(:parent => self) + @states[state].is = value + elsif self.class.validparameter?(state) + self[state] = value + else + raise Puppet::DevError.new("Invalid package state %s" % state) + end + + end + # okay, there are two ways that a package could be created... # either through the language, in which case the hash's values should # be set in 'should', or through comparing against the system, in which |
