diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-01-17 21:34:12 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-01-17 21:34:12 +0000 |
| commit | ada3aee909c1d53ffd4dccaffe913c0ca3a3b397 (patch) | |
| tree | 6082492bd343b9b2bf3ef6718ae69b19c6ffd27c | |
| parent | f36c7d1a450a89dd1883028c78c4166a9d413dbd (diff) | |
| download | puppet-ada3aee909c1d53ffd4dccaffe913c0ca3a3b397.tar.gz puppet-ada3aee909c1d53ffd4dccaffe913c0ca3a3b397.tar.xz puppet-ada3aee909c1d53ffd4dccaffe913c0ca3a3b397.zip | |
Fixing problems where objects were passing @parameters[:param] objects, instead of specifically retrieving the value
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@835 980ebf18-57e1-0310-9a29-db15c13687c0
| -rwxr-xr-x | lib/puppet/server/fileserver.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/type.rb | 4 | ||||
| -rw-r--r-- | lib/puppet/type/pfile.rb | 21 | ||||
| -rwxr-xr-x | lib/puppet/type/pfilebucket.rb | 15 | ||||
| -rw-r--r-- | test/types/package.rb | 2 |
5 files changed, 26 insertions, 18 deletions
diff --git a/lib/puppet/server/fileserver.rb b/lib/puppet/server/fileserver.rb index 8122d6a09..4712a344b 100755 --- a/lib/puppet/server/fileserver.rb +++ b/lib/puppet/server/fileserver.rb @@ -93,7 +93,7 @@ class Server # Deal with ignore parameters. def handleignore(children, path, ignore) - ignore.value.each { |ignore| + ignore.each { |ignore| Dir.glob(File.join(path,ignore), File::FNM_DOTMATCH) { |match| children.delete(File.basename(match)) } diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index ca85f92aa..097359915 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -429,7 +429,7 @@ class Type < Puppet::Element unless param raise Puppet::DevError, "huh? %s" % name end - }[0] + }[0].value end @namevar end @@ -923,7 +923,7 @@ class Type < Puppet::Element unless name.is_a? Symbol name = name.intern end - return @parameters[name] + return @parameters[name].value end def push(*childs) diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb index 2b553abd3..b1e8b325d 100644 --- a/lib/puppet/type/pfile.rb +++ b/lib/puppet/type/pfile.rb @@ -76,8 +76,10 @@ module Puppet Matches that would descend into the directory structure are ignored, e.g., ``*/*``." + defaultto false + validate do |value| - unless value.is_a?(Array) or value.is_a?(String) + unless value.is_a?(Array) or value.is_a?(String) or value == false raise Puppet::DevError.new("Ignore must be a string or an Array") end end @@ -164,7 +166,8 @@ module Puppet end def handleignore(children) - @parameters[:ignore].value.each { |ignore| + return children unless self[:ignore] + self[:ignore].each { |ignore| ignored = [] Dir.glob(File.join(self.name,ignore), File::FNM_DOTMATCH) { |match| ignored.push(File.basename(match)) @@ -223,8 +226,12 @@ module Puppet child = nil klass = nil - if @parameters[:linkmaker] and args.include?(:source) and - ! FileTest.directory?(args[:source]) + + # We specifically look in @parameters here, because 'linkmaker' isn't + # a valid attribute for subclasses, so using 'self[:linkmaker]' throws + # an error. + if @parameters.include?(:linkmaker) and + args.include?(:source) and ! FileTest.directory?(args[:source]) klass = Puppet.type(:symlink) self.debug "%s is a link" % path @@ -324,7 +331,7 @@ module Puppet # Recurse into the directory. This basically just calls 'localrecurse' # and maybe 'sourcerecurse'. def recurse - recurse = @parameters[:recurse] + recurse = self[:recurse] # we might have a string, rather than a number if recurse.is_a?(String) if recurse =~ /^[0-9]+$/ @@ -419,8 +426,8 @@ module Puppet end end - ignore = @parameters[:ignore] - + ignore = self[:ignore] + #self.warning "Listing path %s" % path.inspect desc = server.list(path, r, ignore) diff --git a/lib/puppet/type/pfilebucket.rb b/lib/puppet/type/pfilebucket.rb index dfe1bd4db..2c56ebc30 100755 --- a/lib/puppet/type/pfilebucket.rb +++ b/lib/puppet/type/pfilebucket.rb @@ -34,6 +34,8 @@ module Puppet newparam(:port) do desc "The port on which the remote server is listening. Defaults to the normal Puppet port, %s." % Puppet[:masterport] + + defaultto Puppet[:masterport] end newparam(:path) do @@ -51,12 +53,11 @@ module Puppet def initialize(hash) super - if @parameters.include?(:server) - @parameters[:port] ||= FileBucket::DEFAULTPORT + if self[:server] begin @bucket = Puppet::Client::Dipper.new( - :Server => @parameters[:server], - :Port => @parameters[:port] + :Server => self[:server], + :Port => self[:port] ) rescue => detail raise Puppet::Error.new( @@ -64,10 +65,12 @@ module Puppet ) end else - @parameters[:path] ||= Puppet[:bucketdir] + unless self[:path] + self[:path] = Puppet[:bucketdir] + end begin @bucket = Puppet::Client::Dipper.new( - :Path => @parameters[:path] + :Path => self[:path] ) rescue => detail raise Puppet::Error.new( diff --git a/test/types/package.rb b/test/types/package.rb index 36da3c0cd..9f8c5242e 100644 --- a/test/types/package.rb +++ b/test/types/package.rb @@ -178,8 +178,6 @@ class TestPackages < Test::Unit::TestCase pkg.retrieve - p pkg - assert(! pkg.insync?, "Package is in sync") assert_events([:package_removed], comp, "package") |
