summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Robinson <matt@puppetlabs.com>2011-08-18 17:04:15 -0700
committerMatt Robinson <matt@puppetlabs.com>2011-08-18 17:04:15 -0700
commit249e287ed2dd6260b0289e27606b3cccea402fd5 (patch)
tree4b6711c274b18c7ca7d2f93ae6f436f4ebf14a75
parent208b41e5dd3d5b9285759592acb25892b7c9ba89 (diff)
parent654de01a90297ea460733ad8993d66144cceffa1 (diff)
downloadpuppet-249e287ed2dd6260b0289e27606b3cccea402fd5.tar.gz
puppet-249e287ed2dd6260b0289e27606b3cccea402fd5.tar.xz
puppet-249e287ed2dd6260b0289e27606b3cccea402fd5.zip
Merge pull request #49 from nfagerlund/maint/2.7.x/filebucket_type_and_wrapping
Maint/2.7.x/filebucket type and wrapping
-rw-r--r--lib/puppet/parser/functions/create_resources.rb6
-rw-r--r--lib/puppet/type/file.rb20
-rwxr-xr-xlib/puppet/type/filebucket.rb18
3 files changed, 28 insertions, 16 deletions
diff --git a/lib/puppet/parser/functions/create_resources.rb b/lib/puppet/parser/functions/create_resources.rb
index 8b281515f..646761957 100644
--- a/lib/puppet/parser/functions/create_resources.rb
+++ b/lib/puppet/parser/functions/create_resources.rb
@@ -1,7 +1,8 @@
Puppet::Parser::Functions::newfunction(:create_resources, :doc => <<-'ENDHEREDOC') do |args|
Converts a hash into a set of resources and adds them to the catalog.
- This function takes two arguments: a resource type, and a hash describing a set of resources. The hash should be in the form `{title => {parameters} }`:
+ This function takes two arguments: a resource type, and a hash describing
+ a set of resources. The hash should be in the form `{title => {parameters} }`:
# A hash of user resources:
$myusers = {
@@ -15,7 +16,8 @@ Puppet::Parser::Functions::newfunction(:create_resources, :doc => <<-'ENDHEREDOC
create_resource(user, $myusers)
- This function can be used to create defined resources and classes, as well as native resources.
+ This function can be used to create defined resources and classes, as well
+ as native resources.
ENDHEREDOC
raise ArgumentError, ("create_resources(): wrong number of arguments (#{args.length}; must be 2)") if args.length != 2
#raise ArgumentError, 'requires resource type and param hash' if args.size < 2
diff --git a/lib/puppet/type/file.rb b/lib/puppet/type/file.rb
index 5215be621..9cac37f27 100644
--- a/lib/puppet/type/file.rb
+++ b/lib/puppet/type/file.rb
@@ -75,16 +75,18 @@ Puppet::Type.newtype(:file) do
Puppet automatically creates a local filebucket named `puppet` and
defaults to backing up there. To use a server-based filebucket,
- you must specify one in your configuration
+ you must specify one in your configuration.
filebucket { main:
- server => puppet
+ server => puppet,
+ path => false,
+ # The path => false line works around a known issue with the filebucket type.
}
The `puppet master` daemon creates a filebucket by default,
so you can usually back up to your main server with this
configuration. Once you've described the bucket in your
- configuration, you can use it in any file
+ configuration, you can use it in any file's backup attribute:
file { \"/my/file\":
source => \"/path/in/nfs/or/something\",
@@ -93,12 +95,12 @@ Puppet::Type.newtype(:file) do
This will back the file up to the central server.
- At this point, the benefits of using a filebucket are that you do not
- have backup files lying around on each of your machines, a given
- version of a file is only backed up once, and you can restore
- any given file manually, no matter how old. Eventually,
- transactional support will be able to automatically restore
- filebucketed files.
+ At this point, the benefits of using a central filebucket are that you
+ do not have backup files lying around on each of your machines, a given
+ version of a file is only backed up once, you can restore any given file
+ manually (no matter how old), and you can use Puppet Dashboard to view
+ file contents. Eventually, transactional support will be able to
+ automatically restore filebucketed files.
"
defaultto "puppet"
diff --git a/lib/puppet/type/filebucket.rb b/lib/puppet/type/filebucket.rb
index 7fd2ef46b..59174161b 100755
--- a/lib/puppet/type/filebucket.rb
+++ b/lib/puppet/type/filebucket.rb
@@ -11,15 +11,20 @@ module Puppet
it can be specified as the value of *backup* in a **file** object.
Currently, filebuckets are only useful for manual retrieval of
- accidentally removed files (e.g., you look in the log for the md5 sum and retrieve the file with that sum from the filebucket), but
- when transactions are fully supported filebuckets will be used to
- undo transactions.
+ accidentally removed files (e.g., you look in the log for the md5 sum
+ and retrieve the file with that sum from the filebucket), but when
+ transactions are fully supported filebuckets will be used to undo
+ transactions.
You will normally want to define a single filebucket for your
whole network and then use that as the default backup location:
# Define the bucket
- filebucket { main: server => puppet }
+ filebucket { 'main':
+ server => puppet,
+ path => false,
+ # Due to a known issue, path must be set to false for remote filebuckets.
+ }
# Specify it as the default target
File { backup => main }
@@ -36,7 +41,10 @@ module Puppet
desc "The server providing the remote filebucket. If this is not
specified then *path* is checked. If it is set, then the
bucket is local. Otherwise the puppetmaster server specified
- in the config or at the commandline is used."
+ in the config or at the commandline is used.
+
+ Due to a known issue, you currently must set the `path` attribute to
+ false if you wish to specify a `server` attribute."
defaultto { Puppet[:server] }
end