Puppet Class: elasticsearch::package::pin

Defined in:
manifests/package/pin.pp

Summary

Controls package pinning for the Elasticsearch package.

Overview

This is not intended to be used directly by external resources like node definitions or other modules.

Examples:

This class may be imported by other classes to use its functionality

class { 'elasticsearch::package::pin': }

Author:

  • Tyler Langlois <tyler.langlois@elastic.co>



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'manifests/package/pin.pp', line 11

class elasticsearch::package::pin {

  Exec {
    path => [ '/bin', '/usr/bin', '/usr/local/bin' ],
    cwd  => '/',
  }

  case $::osfamily {
    'Debian': {
      include ::apt

      if ($elasticsearch::ensure == 'absent') {
        apt::pin { $elasticsearch::package_name:
          ensure => $elasticsearch::ensure,
        }
      } elsif ($elasticsearch::version != false) {
        apt::pin { $elasticsearch::package_name:
          ensure   => $elasticsearch::ensure,
          packages => $elasticsearch::package_name,
          version  => $elasticsearch::version,
          priority => 1000,
        }
      }

    }
    'RedHat', 'Linux': {

      if ($elasticsearch::ensure == 'absent') {
        $_versionlock = '/etc/yum/pluginconf.d/versionlock.list'
        $_lock_line = '0:elasticsearch-'
        exec { 'elasticsearch_purge_versionlock.list':
          command => "sed -i '/${_lock_line}/d' ${_versionlock}",
          onlyif  => [
            "test -f ${_versionlock}",
            "grep -F '${_lock_line}' ${_versionlock}",
          ],
        }
      } elsif ($elasticsearch::version != false) {
        yum::versionlock {
          "0:elasticsearch-${elasticsearch::pkg_version}.noarch":
            ensure => $elasticsearch::ensure,
        }
      }

    }
    default: {
      warning("Unable to pin package for OSfamily \"${::osfamily}\".")
    }
  }
}