summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet')
-rwxr-xr-xlib/puppet/provider/parsedfile.rb2
-rwxr-xr-xlib/puppet/util/filetype.rb10
2 files changed, 7 insertions, 5 deletions
diff --git a/lib/puppet/provider/parsedfile.rb b/lib/puppet/provider/parsedfile.rb
index 45eae57ff..40e172785 100755
--- a/lib/puppet/provider/parsedfile.rb
+++ b/lib/puppet/provider/parsedfile.rb
@@ -81,6 +81,8 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
# Make sure our file is backed up, but only back it up once per transaction.
# We cheat and rely on the fact that @records is created on each prefetch.
def self.backup_target(target)
+ return nil unless target_object(target).respond_to?(:backup)
+
unless defined?(@backup_stats)
@backup_stats = {}
end
diff --git a/lib/puppet/util/filetype.rb b/lib/puppet/util/filetype.rb
index 5d4ba1440..40c028cc2 100755
--- a/lib/puppet/util/filetype.rb
+++ b/lib/puppet/util/filetype.rb
@@ -72,11 +72,6 @@ class Puppet::Util::FileType
@filetypes[type]
end
- # Back the file up before replacing it.
- def backup
- bucket.backup(@path) if File.exists?(@path)
- end
-
# Pick or create a filebucket to use.
def bucket
filebucket = Puppet::Type.type(:filebucket)
@@ -90,6 +85,11 @@ class Puppet::Util::FileType
# Operate on plain files.
newfiletype(:flat) do
+ # Back the file up before replacing it.
+ def backup
+ bucket.backup(@path) if File.exists?(@path)
+ end
+
# Read the file.
def read
if File.exist?(@path)