summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-12-02 22:28:22 -0600
committerLuke Kanies <luke@madstop.com>2008-12-02 22:28:22 -0600
commit6b30171435583b1a69c4ffe7b8b1760f5585cd38 (patch)
treed9f0864b1f8426efa1c66227a2d9343be22977f6 /lib
parent99a9b5a045af6f1c68619792a45603cbe450652d (diff)
downloadpuppet-6b30171435583b1a69c4ffe7b8b1760f5585cd38.tar.gz
puppet-6b30171435583b1a69c4ffe7b8b1760f5585cd38.tar.xz
puppet-6b30171435583b1a69c4ffe7b8b1760f5585cd38.zip
Fixing all broken tests. Most of them were broken by fileserving changes.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/property.rb4
-rw-r--r--lib/puppet/type.rb7
-rw-r--r--lib/puppet/type/file.rb3
-rwxr-xr-xlib/puppet/type/file/content.rb2
-rwxr-xr-xlib/puppet/type/file/ensure.rb4
5 files changed, 14 insertions, 6 deletions
diff --git a/lib/puppet/property.rb b/lib/puppet/property.rb
index fd3492970..f8a17ac07 100644
--- a/lib/puppet/property.rb
+++ b/lib/puppet/property.rb
@@ -291,7 +291,7 @@ class Puppet::Property < Puppet::Parameter
# Set a name for looking up associated options like the event.
name = self.class.value_name(value)
- call = self.class.value_option(name, :call)
+ call = self.class.value_option(name, :call) || :none
if call == :instead
event, tmp = call_valuemethod(name, value)
@@ -310,7 +310,7 @@ class Puppet::Property < Puppet::Parameter
# was never used, and it makes things unecessarily complicated.
# If you want to specify a block and still call the setter, then
# do so in the block.
- devfail "Cannot use obsolete :call value %s" % call
+ devfail "Cannot use obsolete :call value '%s' for property '%s'" % [call, self.class.name]
end
return event(name, event)
diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb
index 1854c8801..be37c44c8 100644
--- a/lib/puppet/type.rb
+++ b/lib/puppet/type.rb
@@ -553,6 +553,13 @@ class Type
}
end
+ # If we've got a catalog, then use it to expire our data;
+ # otherwise, null-op.
+ def expire
+ return nil unless expirer
+ super
+ end
+
# Let the catalog determine whether a given cached value is
# still valid or has expired.
def expirer
diff --git a/lib/puppet/type/file.rb b/lib/puppet/type/file.rb
index 463ea7d9e..7c9afb4ff 100644
--- a/lib/puppet/type/file.rb
+++ b/lib/puppet/type/file.rb
@@ -659,7 +659,8 @@ module Puppet
# Remove any existing data. This is only used when dealing with
# links or directories.
def remove_existing(should)
- return unless s = stat(true)
+ expire()
+ return unless s = stat
self.fail "Could not back up; will not replace" unless handlebackup
diff --git a/lib/puppet/type/file/content.rb b/lib/puppet/type/file/content.rb
index 635cdc809..6d6dad4f1 100755
--- a/lib/puppet/type/file/content.rb
+++ b/lib/puppet/type/file/content.rb
@@ -80,7 +80,7 @@ module Puppet
def retrieve
return :absent unless stat = @resource.stat
- # Don't even try to manage the content on directories
+ # Don't even try to manage the content on directories or links
return nil if stat.ftype == "directory"
begin
diff --git a/lib/puppet/type/file/ensure.rb b/lib/puppet/type/file/ensure.rb
index a3cf2d4a6..bd2e2fbdd 100755
--- a/lib/puppet/type/file/ensure.rb
+++ b/lib/puppet/type/file/ensure.rb
@@ -110,8 +110,8 @@ module Puppet
end
def change_to_s(currentvalue, newvalue)
- if property = @resource.property(:content) and ! property.insync?(currentvalue)
- return property.change_to_s(currentvalue, property.should)
+ if property = @resource.property(:content) and content = property.retrieve and ! property.insync?(content)
+ return property.change_to_s(content, property.should)
else
super(currentvalue, newvalue)
end