Puppet Class: perl::cpan

Inherits:
perl
Defined in:
manifests/cpan.pp

Overview

Class: perl::cpan

This class configures cpan.

Parameters:

  • exec_path (Any) (defaults to: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin')
  • exec_environment (Any) (defaults to: [ 'HOME=/root' ])
  • exec_command (Any) (defaults to: 'exec_default')


5
6
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
35
36
37
38
39
40
41
42
43
# File 'manifests/cpan.pp', line 5

class perl::cpan (
  $exec_path        = '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin',
  $exec_environment = [ 'HOME=/root' ],
  $exec_command     = 'exec_default',
) inherits perl {

  $default_exec_command = "cpan <<EOF
yes
yes
no
no
${perl::cpan_mirror}

yes
quit
EOF"

  $real_exec_command = $exec_command ? {
    'exec_default' => $default_exec_command,
    default        => $exec_command,
  }

  if $perl::cpan_package != '' and ! defined(Package[$perl::cpan_package]) {
    package { $perl::cpan_package:
      ensure  => $perl::manage_cpan_package,
    }
  }

  exec{ 'configure_cpan':
    command     => $real_exec_command,
    creates     => '/root/.cpan/CPAN/MyConfig.pm',
    require     => [ Package[$perl::cpan_package] ],
    user        => root,
    path        => $exec_path,
    timeout     => 600,
    environment => $exec_environment,
  }

}