Puppet Class: snapshot::dumps::nfstester

Defined in:
modules/snapshot/manifests/dumps/nfstester.pp

Overview

SPDX-License-Identifier: Apache-2.0

configuration file, output directories, and documentation for how to test a new dumps nfs share

Parameters:

  • user (Any) (defaults to: undef)
  • group (Any) (defaults to: undef)
  • homedir (Any) (defaults to: undef)


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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'modules/snapshot/manifests/dumps/nfstester.pp', line 5

class snapshot::dumps::nfstester(
    $user   = undef,
    $group  = undef,
    $homedir = undef,
) {
    # for nfs testing we place the xml dumps config file,
    # all dblists and other files under the home
    # directory of the user that runs the dumps

    $nfstestingdir = "${homedir}/nfs_testing"
    file { $nfstestingdir:
      ensure => 'directory',
      mode   => '0755',
      owner  => $user,
      group  => $group,
    }

    $confsdir = "${nfstestingdir}/confs"
    $dblistsdir = "${nfstestingdir}/dblists"

    # the stages directory will be left empty but it should be specified
    $stagesdir = "${nfstestingdir}/stages"

    $templsdir = "${nfstestingdir}/templs"
    file { [ $confsdir, $dblistsdir, $stagesdir,
      $templsdir ]:

      ensure => 'directory',
      mode   => '0755',
      owner  => $user,
      group  => $group,
    }

    # dir will be written in by the dumps process run by the user
    $cachedir = "${nfstestingdir}/cache"
    file { $cachedir:
      ensure => 'directory',
      mode   => '0755',
      owner  => $user,
      group  => $group,
    }

    # these wikis are small enough to be useful for testing but still have a little activity each week
    # so that revision prefetch testing and adds/changes dumps will work with them
    $testwikis = [ 'igwiki', 'olowiki', 'snwiki' ]
    $allwikis = join($testwikis, "\n")
    $allwikisdblist = "${dblistsdir}/all.dblist"
    file { $allwikisdblist:
        ensure  => 'present',
        path    => "${dblistsdir}/all.dblist",
        mode    => '0644',
        owner   => $user,
        group   => $group,
        content => "${allwikis}\n",
    }

    # these files can all be empty
    $privatedblist = "${dblistsdir}/privatewikis.dblist"
    $closeddblist = "${dblistsdir}/closedwikis.dblist"
    $skipdblist = "${dblistsdir}/skip.dblist"
    $skipmonitorlist = "${dblistsdir}/skipmonitor.dblist"

    file { [ $privatedblist, $closeddblist, $skipdblist, $skipmonitorlist ]:

        ensure  => 'present',
        mode    => '0644',
        owner   => $user,
        group   => $group,
        content => '',
    }

    $mountpoint = '/mnt/dumpsdatatest'
    $nfstestdir = "${mountpoint}/nfstest"
    $dumpstree = "${nfstestdir}/xmldatadumps"
    $otherdumpsdir = "${nfstestdir}/otherdumps"
    $publicdir = "${dumpstree}/public"
    $privatedir = "${dumpstree}/private"
    $tempdir = "${dumpstree}/temp"

    file { $mountpoint:
      ensure => 'directory',
      mode   => '0755',
      owner  => root,
      group  => root,
    }

    # the nfs share to be tested will be manually mounted. after that, we
    # want to run a script to create all the needed directories over there
    # if they do not exist from a previous test session.
    file { "${nfstestingdir}/test_outputdir_paths.sh":
      ensure  => 'present',
      mode    => '0755',
      owner   => $user,
      group   => $group,
      content => template('snapshot/dumps/nfs_testing/test_outputdir_paths.sh.erb'),
    }

    file {"${nfstestingdir}/nfs_testing_create_output_dirs.sh":
      ensure => 'present',
      mode   => '0755',
      owner  => $user,
      group  => $group,
      source => 'puppet:///modules/snapshot/dumps/nfs_testing/create_output_dirs.sh',
    }

    # set up a custom xml dumps conf file for this testing, using the
    # custom outpuit paths and db lists and so on
    file { "${confsdir}/xmldumps.conf":
      ensure  => 'present',
      mode    => '0755',
      owner   => $user,
      group   => $group,
      content => template('snapshot/dumps/nfs_testing/nfstester_xmldumps.conf.erb')
    }

    # set up a custom adds-changes dumps conf file for nfs share testing
    file { "${confsdir}/addschanges.conf":
      ensure  => 'present',
      mode    => '0755',
      owner   => $user,
      group   => $group,
      content => template('snapshot/dumps/nfs_testing/nfstester_addschanges.conf.erb')
    }

    # set up a custom conf file for the rest of the dumps, for nfs share testing
    file { "${confsdir}/otherdumps.conf":
      ensure  => 'present',
      mode    => '0755',
      owner   => $user,
      group   => $group,
      content => template('snapshot/dumps/nfs_testing/nfstester_otherdumps.conf.erb')
    }

    # add documentation on how to test, since many commands must be run
    # manually; at least we won't have to look them up each time.
    file { "${nfstestingdir}/README_nfstesting.txt":
      ensure  => 'present',
      mode    => '0444',
      owner   => $user,
      group   => $group,
      content => template('snapshot/dumps/nfs_testing/README_nfstesting.txt.erb'),
    }

}