Defined Type: puppetmaster::gitprivate

Defined in:
modules/puppetmaster/manifests/gitprivate.pp

Overview

Sets up the private repo dir and all the corresponding git hooks

Parameters:

  • bare (Any) (defaults to: false)
  • owner (Any) (defaults to: 'root')
  • group (Any) (defaults to: 'root')
  • dir_mode (Any) (defaults to: '0750')
  • origin (Any) (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
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
# File 'modules/puppetmaster/manifests/gitprivate.pp', line 2

define puppetmaster::gitprivate (
    $bare=false,
    $owner='root',
    $group='root',
    $dir_mode='0750',
    $origin=undef,
    ){

    if $bare {
        $init = '/usr/bin/git --bare init'
        $creates = "${title}/config"
        $prefix = $title
    } else {
        $init = '/usr/bin/git init'
        $creates = "${title}/.git"
        $prefix = $creates
    }

    if ($origin and !$bare) {
        git::clone { 'operations/private':
            directory => $title,
            owner     => $owner,
            group     => $group,
            origin    => $origin,
            mode      => $dir_mode,
        }
    } else {
        # Create the directory
        file { $title:
            ensure => directory,
            owner  => $owner,
            group  => $group,
            mode   => $dir_mode,
        }


        # Initialize a git repository (bare or otherwise)
        exec { "git init for ${title}":
            command => $init,
            user    => $owner,
            group   => $group,
            cwd     => $title,
            creates => $creates,
            require => File[$title],
        }
    }


    # Now all the common hooks there
    file {
        "${prefix}/hooks/post-merge":
            ensure => 'absent';
        "${prefix}/hooks/pre-commit":
            source => 'puppet:///modules/puppetmaster/git/private/pre-commit',
            owner  => $owner,
            group  => $group,
            mode   => '0550';
        "${prefix}/hooks/pre-merge":
            source => 'puppet:///modules/puppetmaster/git/private/pre-merge',
            owner  => $owner,
            group  => $group,
            mode   => '0550';
        "${prefix}/hooks/pre-rebase":
            source => 'puppet:///modules/puppetmaster/git/private/pre-rebase',
            owner  => $owner,
            group  => $group,
            mode   => '0550';
    }

}