Update stdlib and concat to 6.1.0 both
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / lib / puppet / type / anchor.rb
1 Puppet::Type.newtype(:anchor) do
2   desc <<-DOC
3   @summary
4     A simple resource type intended to be used as an anchor in a composite class.
5
6   In Puppet 2.6, when a class declares another class, the resources in the
7   interior class are not contained by the exterior class. This interacts badly
8   with the pattern of composing complex modules from smaller classes, as it
9   makes it impossible for end users to specify order relationships between the
10   exterior class and other modules.
11
12   The anchor type lets you work around this. By sandwiching any interior
13   classes between two no-op resources that _are_ contained by the exterior
14   class, you can ensure that all resources in the module are contained.
15
16   ```
17   class ntp {
18     # These classes will have the correct order relationship with each
19     # other. However, without anchors, they won't have any order
20     # relationship to Class['ntp'].
21     class { 'ntp::package': }
22     -> class { 'ntp::config': }
23     -> class { 'ntp::service': }
24
25     # These two resources "anchor" the composed classes within the ntp
26     # class.
27     anchor { 'ntp::begin': } -> Class['ntp::package']
28     Class['ntp::service']    -> anchor { 'ntp::end': }
29   }
30   ```
31
32   This allows the end user of the ntp module to establish require and before
33   relationships with Class['ntp']:
34
35   ```
36   class { 'ntp': } -> class { 'mcollective': }
37   class { 'mcollective': } -> class { 'ntp': }
38   ```
39
40   DOC
41
42   newparam :name do
43     desc 'The name of the anchor resource.'
44   end
45   def refresh
46     # We don't do anything with them, but we need this to
47     #   show that we are "refresh aware" and not break the
48     #   chain of propagation.
49   end
50 end