Puppet Class: storm::backend::configdb

Defined in:
manifests/backend/configdb.pp

Summary

StoRM Backend DB config class

Overview



3
4
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/backend/configdb.pp', line 3

class storm::backend::configdb (

) {
  $db_hostname = $storm::backend::db_hostname
  $db_username = $storm::backend::db_username
  $db_password = $storm::backend::db_password

  file { '/tmp/storm_db.sql':
    ensure => file,
    source => 'puppet:///modules/storm/storm_db.sql',
  }

  file { '/tmp/storm_be_ISAM.sql':
    ensure => file,
    source => 'puppet:///modules/storm/storm_be_ISAM.sql',
  }

  $paths = ['/bin', '/usr/bin', '/sbin', '/usr/sbin', '/usr/local/bin']
  $storm_db_query = 'use storm_db;select major from db_version;'
  $check_storm_db = "! mysql -h ${db_hostname} -u${db_username} -p${db_password} -e \"${storm_db_query}\""
  exec { 'storm_db-import':
    command     => 'mysql storm_db < /tmp/storm_db.sql',
    onlyif      => $check_storm_db,
    logoutput   => true,
    environment => "HOME=${::root_home}",
    path        => $paths,
    provider    => 'shell',
    require     => [File['/tmp/storm_db.sql']],
  }
  $storm_be_isam_query = 'use storm_be_ISAM;select major from db_version;'
  $check_storm_be_isam = "! mysql -h ${db_hostname} -u${db_username} -p${db_password} -e \"${storm_be_isam_query}\""
  exec { 'storm_be_ISAM-import':
    command     => 'mysql storm_be_ISAM < /tmp/storm_be_ISAM.sql',
    onlyif      => $check_storm_be_isam,
    logoutput   => true,
    environment => "HOME=${::root_home}",
    path        => $paths,
    provider    => 'shell',
    require     => [File['/tmp/storm_be_ISAM.sql']],
  }
}