[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35
Luke Kanies
luke at puppetlabs.com
Wed Jul 14 10:32:27 UTC 2010
The following commit has been merged in the upstream branch:
commit 13d141acce03b50f1bfdee2b2a2cba87bcb3da70
Author: Luke Kanies <luke at puppetlabs.com>
Date: Mon Apr 12 14:10:17 2010 -0700
Fixing Property#change_to_s in rare case failures
If we were removing a field, which really only 'cron'
does, then we got an exception.
This is fixed, and now tested.
Signed-off-by: Luke Kanies <luke at puppetlabs.com>
diff --git a/lib/puppet/property.rb b/lib/puppet/property.rb
index 4b58abd..5e616c3 100644
--- a/lib/puppet/property.rb
+++ b/lib/puppet/property.rb
@@ -122,14 +122,14 @@ class Puppet::Property < Puppet::Parameter
end
# How should a property change be printed as a string?
- def change_to_s(currentvalue, newvalue)
+ def change_to_s(current_value, newvalue)
begin
- if currentvalue == :absent
+ if current_value == :absent
return "defined '#{name}' as '#{should_to_s(newvalue)}'"
elsif newvalue == :absent or newvalue == [:absent]
return "undefined '#{name}' from '#{is_to_s(current_value)}'"
else
- return "#{name} changed '#{is_to_s(currentvalue)}' to '#{should_to_s(newvalue)}'"
+ return "#{name} changed '#{is_to_s(current_value)}' to '#{should_to_s(newvalue)}'"
end
rescue Puppet::Error, Puppet::DevError
raise
diff --git a/spec/unit/property.rb b/spec/unit/property.rb
index 64bad19..d99f42a 100755
--- a/spec/unit/property.rb
+++ b/spec/unit/property.rb
@@ -1,4 +1,4 @@
-#!/usr/bin/env ruby"
+#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../spec_helper'
require 'puppet/property'
@@ -399,4 +399,18 @@ describe Puppet::Property do
end
end
end
+
+ describe "when producing a change log" do
+ it "should say 'defined' when the current value is 'absent'" do
+ @property.change_to_s(:absent, "foo").should =~ /^defined/
+ end
+
+ it "should say 'undefined' when the new value is 'absent'" do
+ @property.change_to_s("foo", :absent).should =~ /^undefined/
+ end
+
+ it "should say 'changed' when neither value is 'absent'" do
+ @property.change_to_s("foo", "bar").should =~ /changed/
+ end
+ end
end
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list