Defined Type: sqlite::db

Defined in:
modules/sqlite/manifests/db.pp

Overview

Parameters:

  • ensure (Wmflib::Ensure) (defaults to: 'present')
  • owner (String) (defaults to: 'root')
  • group (String) (defaults to: 'root')
  • mode (Stdlib::Filemode) (defaults to: '0660')
  • db_path (Optional[Stdlib::Unixpath]) (defaults to: undef)
  • sql_schema (Optional[Stdlib::Unixpath]) (defaults to: undef)


2
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
# File 'modules/sqlite/manifests/db.pp', line 2

define sqlite::db (
    Wmflib::Ensure             $ensure     = 'present',
    String                     $owner      = 'root',
    String                     $group      = 'root',
    Stdlib::Filemode           $mode       = '0660',
    Optional[Stdlib::Unixpath] $db_path    = undef,
    Optional[Stdlib::Unixpath] $sql_schema = undef,
) {
    include sqlite
    $_db_path = $db_path ? {
        undef   => "${sqlite::default_db_path}/${title}.db",
        default => $db_path,
    }
    file {$_db_path:
        ensure => $ensure,
        owner  => $owner,
        group  => $group,
    }
    if $sql_schema {
        exec{"sqlite_initialist_db_${title}":
            path        => ['/bin', '/usr/bin'],
            user        => $owner,
            group       => $group,
            command     => "cat ${sql_schema} | ${sqlite::sqlite_cmd} ${_db_path}",
            refreshonly => true,
            subscribe   => File[$_db_path],
        }
    }
}