Puppet Class: crm::tools

Defined in:
puppet/modules/crm/manifests/tools.pp

Overview

Class: crm::tools

Miscellaneous tools written in Python.

Parameters

dir

Installation directory.

Parameters:

  • dir (Any)
  • silverpop_db_name (Any)
  • silverpop_db_user (Any)
  • silverpop_db_pass (Any)


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
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
# File 'puppet/modules/crm/manifests/tools.pp', line 10

class crm::tools(
    $dir,
    $silverpop_db_name,
    $silverpop_db_user,
    $silverpop_db_pass,
) {
    $audit_base = '/var/spool/audit'

    require_package(
        'default-libmysqlclient-dev',
        'libyaml-dev',
        'libffi-dev',
    )

    git::clone { 'wikimedia/fundraising/tools':
        directory => $dir,
    }

    file { '/etc/fundraising':
        ensure => 'directory',
        mode   => '0755',
    }

    file { '/etc/fundraising/silverpop_export.yaml':
        ensure  => 'file',
        content => template('crm/silverpop_export.yaml.erb'),
        mode    => '0644',
        require => File['/etc/fundraising'],
    }

    mysql::user { $silverpop_db_user:
      ensure   => present,
      grant    => 'ALL ON *.*',
      password => $silverpop_db_pass,
      require  => Mysql::Db[$silverpop_db_name],
    }

    mysql::db { $silverpop_db_name: }

    exec { 'create_silverpop_reference_data':
        command => "/usr/bin/mysql -u${silverpop_db_user} -p${silverpop_db_pass} '${silverpop_db_name}' < ${dir}/silverpop_export/silverpop_countrylangs.sql",
        unless  => "/usr/bin/mysql -u${silverpop_db_user} -p${silverpop_db_pass} '${silverpop_db_name}' -e 'select 1 from silverpop_countrylangs'",
        require => [
            Git::Clone['wikimedia/fundraising/tools'],
            Mysql::Db[$silverpop_db_name],
            Mysql::User[$silverpop_db_user]
        ],
    }

    exec { 'frtools_python_requirements':
        command => "pip install --upgrade setuptools; pip install -r ${dir}/requirements.txt",
        require => [
            Git::Clone['wikimedia/fundraising/tools'],
            Package['default-libmysqlclient-dev'],
            Package['libyaml-dev'],
            Package['libffi-dev'],
        ],
    }
}