Defined Type: nodejs::alias

Defined in:
manifests/alias.pp

Overview

Parameters:

  • ensure (Any) (defaults to: 'installed')
  • to (Any) (defaults to: undef)
  • version (Any) (defaults to: $title)


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'manifests/alias.pp', line 7

define nodejs::alias(
  $ensure  = 'installed',
  $to      = undef,
  $version = $title,
) {

  require nodejs

  if $to == undef {
    fail('to cannot be undefined')
  }

  if $ensure != 'absent' {
    ensure_resource('nodejs::version', $to)
  }

  $file_ensure = $ensure ? {
    /^(installed|present)$/ => 'symlink',
    default                 => $ensure,
  }

  file { "/opt/nodes/${version}":
    ensure  => $file_ensure,
    force   => true,
    target  => "/opt/nodes/${to}",
    require => Nodejs::Version[$to],
  }
}