Puppet Class: elasticsearch::package::pin

Defined in:
manifests/package/pin.pp

Overview

Class: elasticsearch::package::pin

Controls package pinning for the Elasticsearch package.

Parameters

This class does not provide any parameters.

Examples

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

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

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

Authors



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
61
62
63
64
65
66
67
68
69
70
# File 'manifests/package/pin.pp', line 21

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}\".")
    }
  }
}