diff options
| author | Matt Robinson <matt@puppetlabs.com> | 2011-03-29 11:06:58 -0700 |
|---|---|---|
| committer | Matt Robinson <matt@puppetlabs.com> | 2011-03-29 11:06:58 -0700 |
| commit | 54f15b6eae233c291ef14c4224ee1280aa09761e (patch) | |
| tree | 8b4327a69f2fbe268526ad828c35019154f7a4f9 /lib/puppet | |
| parent | 6985cc0f898d71dbd2ffbb353a2a482d9783cb42 (diff) | |
| parent | 1ac7f63f00c517c6dff67be8d927b968c7bcb6ea (diff) | |
| download | puppet-54f15b6eae233c291ef14c4224ee1280aa09761e.tar.gz puppet-54f15b6eae233c291ef14c4224ee1280aa09761e.tar.xz puppet-54f15b6eae233c291ef14c4224ee1280aa09761e.zip | |
Merge branch 'ticket/next/6830-ready_to_merge' into next
* ticket/next/6830-ready_to_merge:
(#6830) Fix tests that depended on special inherited behavior
(#6830) Fix overly stubbed tests
(#6830) Fix instance_variables now comes back as symbols
(#6830) Fix badly stubbed Time object in test
(#6830) Fix MD5 handling to work with Ruby 1.9
(#6830) Fix File class scoping
(#6830) Handle case where array is actually a string
(#6830) Fix case where instance_variables returns symbols in Ruby 1.9
Diffstat (limited to 'lib/puppet')
| -rw-r--r-- | lib/puppet/parser/functions/fqdn_rand.rb | 4 | ||||
| -rw-r--r-- | lib/puppet/simple_graph.rb | 5 | ||||
| -rw-r--r-- | lib/puppet/transaction/event.rb | 2 | ||||
| -rwxr-xr-x | lib/puppet/type/tidy.rb | 6 | ||||
| -rw-r--r-- | lib/puppet/type/zone.rb | 2 | ||||
| -rwxr-xr-x | lib/puppet/type/zpool.rb | 1 |
6 files changed, 12 insertions, 8 deletions
diff --git a/lib/puppet/parser/functions/fqdn_rand.rb b/lib/puppet/parser/functions/fqdn_rand.rb index 52946f2c1..91157a148 100644 --- a/lib/puppet/parser/functions/fqdn_rand.rb +++ b/lib/puppet/parser/functions/fqdn_rand.rb @@ -5,8 +5,8 @@ Puppet::Parser::Functions::newfunction(:fqdn_rand, :type => :rvalue, :doc => $random_number = fqdn_rand(30) $random_number_seed = fqdn_rand(30,30)") do |args| - require 'md5' + require 'digest/md5' max = args.shift - srand MD5.new([lookupvar('fqdn'),args].join(':')).to_s.hex + srand(Digest::MD5.hexdigest([lookupvar('fqdn'),args].join(':')).hex) rand(max).to_s end diff --git a/lib/puppet/simple_graph.rb b/lib/puppet/simple_graph.rb index ed71a64f3..27e068e30 100644 --- a/lib/puppet/simple_graph.rb +++ b/lib/puppet/simple_graph.rb @@ -570,7 +570,10 @@ class Puppet::SimpleGraph end def to_yaml_properties - other_vars = instance_variables.reject { |v| %w{@in_to @out_from @upstream_from @downstream_from}.include?(v) } + other_vars = instance_variables. + map {|v| v.to_s}. + reject { |v| %w{@in_to @out_from @upstream_from @downstream_from}.include?(v) } + (other_vars + %w{@vertices @edges}).sort.uniq end diff --git a/lib/puppet/transaction/event.rb b/lib/puppet/transaction/event.rb index cd695cff8..d3f25b71c 100644 --- a/lib/puppet/transaction/event.rb +++ b/lib/puppet/transaction/event.rb @@ -48,7 +48,7 @@ class Puppet::Transaction::Event end def to_yaml_properties - (YAML_ATTRIBUTES & instance_variables).sort + (YAML_ATTRIBUTES.map {|ya| ya.to_s} & instance_variables.map{|iv| iv.to_s}).sort end private diff --git a/lib/puppet/type/tidy.rb b/lib/puppet/type/tidy.rb index 93a7e96cf..146481fed 100755 --- a/lib/puppet/type/tidy.rb +++ b/lib/puppet/type/tidy.rb @@ -254,7 +254,7 @@ Puppet::Type.newtype(:tidy) do if parameter files = Puppet::FileServing::Fileset.new(self[:path], parameter).files.collect do |f| - f == "." ? self[:path] : File.join(self[:path], f) + f == "." ? self[:path] : ::File.join(self[:path], f) end else files = [self[:path]] @@ -270,7 +270,7 @@ Puppet::Type.newtype(:tidy) do files_by_name = result.inject({}) { |hash, file| hash[file[:path]] = file; hash } files_by_name.keys.sort { |a,b| b <=> b }.each do |path| - dir = File.dirname(path) + dir = ::File.dirname(path) next unless resource = files_by_name[dir] if resource[:require] resource[:require] << Puppet::Resource.new(:file, path) @@ -321,7 +321,7 @@ Puppet::Type.newtype(:tidy) do def stat(path) begin - File.lstat(path) + ::File.lstat(path) rescue Errno::ENOENT => error info "File does not exist" return nil diff --git a/lib/puppet/type/zone.rb b/lib/puppet/type/zone.rb index 1bae93120..0fc702ccf 100644 --- a/lib/puppet/type/zone.rb +++ b/lib/puppet/type/zone.rb @@ -409,7 +409,7 @@ Puppet::Type.newtype(:zone) do # both as prerequisites. autorequire(:file) do if @parameters.include? :path - [@parameters[:path].value, File.dirname(@parameters[:path].value)] + [@parameters[:path].value, ::File.dirname(@parameters[:path].value)] else nil end diff --git a/lib/puppet/type/zpool.rb b/lib/puppet/type/zpool.rb index 40ee8f286..2da713c2b 100755 --- a/lib/puppet/type/zpool.rb +++ b/lib/puppet/type/zpool.rb @@ -4,6 +4,7 @@ module Puppet class VDev < Property def flatten_and_sort(array) + array = [array] unless array.is_a? Array array.collect { |a| a.split(' ') }.flatten.sort end |
