File: soft_include.pp

package info (click to toggle)
puppet-module-puppet-community-mcollective 0.6.2-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 600 kB
  • sloc: ruby: 1,301; sh: 15; makefile: 15
file content (28 lines) | stat: -rw-r--r-- 1,057 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# private define - mcollective::soft_include

# Attempts to include a class which may not exist.  If it does it also
# sandwiches it in between the $start and $end resources (typically anchors).
#
# This is somewhat useful as certain plugins may have specific options for
# client/server, for example the ssl securityprovider has the following classes:
#    mcollective::config::common::securityprovider::ssl
#    mcollective::config::client::securityprovider::ssl
#    mcollective::config::server::securityprovider::ssl
#
# But the psk securityprovider only needs a single common class:
#    mcollective::config::common::securityprovider::psk
#
# To avoid having empty server and client classes, instead in the
# respective common, client, and server classes we can soft_include
# mcollective::config::${role}::securityprovider::${mcollective::securityprovider}

define mcollective::soft_include($start, $end) {
  # does the class exist?
  if defined($name) {
    # declare it
    class { $name:
      require => $start,
      before  => $end,
    }
  }
}