~ubuntu-branches/ubuntu/quantal/puppet/quantal

« back to all changes in this revision

Viewing changes to lib/puppet/type/file/source.rb

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-07-14 01:56:30 UTC
  • mfrom: (1.1.29) (3.1.43 sid)
  • Revision ID: package-import@ubuntu.com-20120714015630-ntj41rkvkq4zph4y
Tags: 2.7.18-1ubuntu1
* Resynchronise with Debian. (LP: #1023931) Remaining changes:
  - debian/puppetmaster-passenger.postinst: Make sure we error if puppet
    config print doesn't work
  - debian/puppetmaster-passenger.postinst: Ensure upgrades from
    <= 2.7.11-1 fixup passenger apache configuration.
* Dropped upstreamed patches:
  - debian/patches/CVE-2012-1906_CVE-2012-1986_to_CVE-2012-1989.patch
  - debian/patches/puppet-12844
  - debian/patches/2.7.17-Puppet-July-2012-CVE-fixes.patch
* Drop Build-Depends on ruby-rspec (in universe):
  - debian/control: remove ruby-rspec from Build-Depends
  - debian/patches/no-rspec.patch: make Rakefile work anyway if rspec
    isn't installed so we can use it in debian/rules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
 
14
14
    attr_accessor :source, :local
15
15
    desc <<-EOT
16
 
      Copy a file over the current file.  Uses `checksum` to
17
 
      determine when a file should be copied.  Valid values are either
18
 
      fully qualified paths to files, or URIs.  Currently supported URI
19
 
      types are *puppet* and *file*.
20
 
 
21
 
      This is one of the primary mechanisms for getting content into
22
 
      applications that Puppet does not directly support and is very
23
 
      useful for those configuration files that don't change much across
24
 
      sytems.  For instance:
25
 
 
26
 
          class sendmail {
27
 
            file { "/etc/mail/sendmail.cf":
28
 
              source => "puppet://server/modules/module_name/sendmail.cf"
29
 
            }
30
 
          }
31
 
 
32
 
      You can also leave out the server name, in which case `puppet agent`
33
 
      will fill in the name of its configuration server and `puppet apply`
34
 
      will use the local filesystem.  This makes it easy to use the same
35
 
      configuration in both local and centralized forms.
36
 
 
37
 
      Currently, only the `puppet` scheme is supported for source
38
 
      URL's. Puppet will connect to the file server running on
39
 
      `server` to retrieve the contents of the file. If the
40
 
      `server` part is empty, the behavior of the command-line
41
 
      interpreter (`puppet apply`) and the client demon (`puppet agent`) differs
42
 
      slightly: `apply` will look such a file up on the module path
43
 
      on the local host, whereas `agent` will connect to the
44
 
      puppet server that it received the manifest from.
45
 
 
46
 
      See the [fileserver configuration documentation](http://docs.puppetlabs.com/guides/file_serving.html)
47
 
      for information on how to configure and use file services within Puppet.
48
 
 
49
 
      If you specify multiple file sources for a file, then the first
50
 
      source that exists will be used.  This allows you to specify
51
 
      what amount to search paths for files:
52
 
 
53
 
          file { "/path/to/my/file":
 
16
      A source file, which will be copied into place on the local system.
 
17
      Values can be URIs pointing to remote files, or fully qualified paths to
 
18
      files available on the local system (including files on NFS shares or
 
19
      Windows mapped drives). This attribute is mutually exclusive with
 
20
      `content` and `target`.
 
21
 
 
22
      The available URI schemes are *puppet* and *file*. *Puppet*
 
23
      URIs will retrieve files from Puppet's built-in file server, and are
 
24
      usually formatted as:
 
25
 
 
26
      `puppet:///modules/name_of_module/filename`
 
27
 
 
28
      This will fetch a file from a module on the puppet master (or from a
 
29
      local module when using puppet apply). Given a `modulepath` of
 
30
      `/etc/puppetlabs/puppet/modules`, the example above would resolve to
 
31
      `/etc/puppetlabs/puppet/modules/name_of_module/files/filename`.
 
32
 
 
33
      Unlike `content`, the `source` attribute can be used to recursively copy
 
34
      directories if the `recurse` attribute is set to `true` or `remote`. If
 
35
      a source directory contains symlinks, use the `links` attribute to
 
36
      specify whether to recreate links or follow them.
 
37
 
 
38
      Multiple `source` values can be specified as an array, and Puppet will
 
39
      use the first source that exists. This can be used to serve different
 
40
      files to different system types:
 
41
 
 
42
          file { "/etc/nfs.conf":
54
43
            source => [
55
 
              "/modules/nfs/files/file.$host",
56
 
              "/modules/nfs/files/file.$operatingsystem",
57
 
              "/modules/nfs/files/file"
 
44
              "puppet:///modules/nfs/conf.$host",
 
45
              "puppet:///modules/nfs/conf.$operatingsystem",
 
46
              "puppet:///modules/nfs/conf"
58
47
            ]
59
48
          }
60
49
 
61
 
      This will use the first found file as the source.
62
 
 
63
 
      You cannot currently copy links using this mechanism; set `links`
64
 
      to `follow` if any remote sources are links.
 
50
      Alternately, when serving directories recursively, multiple sources can
 
51
      be combined by setting the `sourceselect` attribute to `all`.
65
52
    EOT
66
53
 
67
54
    validate do |sources|