Puppet Class: xdmod::supremm::config

Defined in:
manifests/supremm/config.pp

Summary

Manage XDMoD SUPReMM configs

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
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
71
72
73
74
# File 'manifests/supremm/config.pp', line 3

class xdmod::supremm::config {
  $mysql_remote_args = $xdmod::_mysql_remote_args
  $modw_supremm_sql = '/usr/lib64/python2.7/site-packages/supremm/assets/modw_supremm.sql'
  $mongo_setup = '/usr/lib64/python2.7/site-packages/supremm/assets/mongo_setup.js'

  exec { 'update-modw_supremm':
    path    => '/usr/bin:/bin:/usr/sbin:/sbin',
    command => "mysql ${mysql_remote_args} -D modw_supremm < ${modw_supremm_sql}",
    onlyif  => "mysql -BN ${mysql_remote_args} -e 'SHOW DATABASES' | egrep -q '^modw_supremm$'",
    unless  => "mysql -BN ${mysql_remote_args} -e 'SELECT DISTINCT table_name FROM information_schema.columns WHERE table_schema=\"modw_supremm\"' | egrep -q '^archive_paths$'", # lint:ignore:140chars
    require => Package['mysql_client'],
  }

  exec { 'mongodb-supremm-schema':
    path    => '/usr/bin:/bin:/usr/sbin:/sbin',
    command => "mongo ${xdmod::supremm_mongo_args} ${mongo_setup}",
    onlyif  => "test `mongo --quiet ${xdmod::supremm_mongo_args} --eval 'db.schema.count()'` -eq 0",
    require => Package['mongodb_client'],
  }

  exec { 'mongodb-supremm-schema-refresh':
    path        => '/usr/bin:/bin:/usr/sbin:/sbin',
    command     => "mongo ${xdmod::supremm_mongo_args} ${mongo_setup}",
    onlyif      => "test `mongo --quiet ${xdmod::supremm_mongo_args} --eval 'db.schema.count()'` -gt 0",
    refreshonly => true,
    require     => Package['mongodb_client'],
    subscribe   => Class['xdmod::supremm::install'],
  }

  if $xdmod::supremm_mysql_access == 'defaultsfile' {
    $_defaults_file_ensure = 'file'
  } else {
    $_defaults_file_ensure = 'absent'
  }

  file { '/root/.supremm.my.cnf':
    ensure    => $_defaults_file_ensure,
    owner     => 'root',
    group     => 'root',
    mode      => '0600',
    content   => template('xdmod/supremm/supremm.my.cnf.erb'),
    show_diff => false,
  }

  file { '/etc/supremm/config.json':
    ensure    => 'file',
    owner     => 'root',
    group     => 'root',
    mode      => '0640',
    content   => template('xdmod/supremm/config.json.erb'),
    show_diff => false,
  }

  # Determine if job scripts are to be ingested
  $resources_with_script_dir = $xdmod::supremm_resources.filter |$r| {
    has_key($r, 'script_dir')
  }
  if empty($resources_with_script_dir) {
    $ingest_jobscripts = false
  } else {
    $ingest_jobscripts = true
  }
  if $xdmod::manage_supremm_cron {
    file { '/etc/cron.d/supremm':
      ensure  => 'file',
      owner   => 'root',
      group   => 'root',
      mode    => '0644',
      content => template('xdmod/supremm/cron.erb'),
    }
  }
}