Defined Type: git::install

Defined in:
modules/git/manifests/install.pp

Overview

Parameters:

  • directory (Any)
  • git_tag (Any)
  • lock_file (Any) (defaults to: '')
  • post_checkout (Any) (defaults to: undef)
  • owner (Any) (defaults to: 'root')
  • group (Any) (defaults to: 'root')
  • ensure (Any) (defaults to: 'present')


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
# File 'modules/git/manifests/install.pp', line 46

define git::install(
    $directory,
    $git_tag,
    $lock_file='',
    $post_checkout=undef,
    $owner='root',
    $group='root',
    $ensure='present',
    )
{
    # Git clone runs once, then we perform a "forward-to-tag" operation
    git::clone{$title:
        ensure    => $ensure,
        directory => $directory,
        owner     => $owner,
        group     => $group,
        mode      => '0755',
    }

    if $ensure == 'present' {

        if $post_checkout != undef {
            file {"callback-hook-${title}":
                ensure  => 'present',
                path    => "${directory}/.git/hooks/post-checkout",
                mode    => '0554',
                source  => $post_checkout,
                owner   => $owner,
                group   => $group,
                require => Git::Clone[$title],
            }
        }


        exec {"git_update_${title}":
            command => '/usr/bin/git remote update && git fetch --tags',
            cwd     => $directory,
            user    => $owner,
            unless  => "git clean -df && git checkout . && git diff HEAD..${git_tag} --exit-code",
            path    => '/usr/bin/',
            require => Git::Clone[$title],
            notify  => Exec["git_checkout_${title}"],
        }

        if $lock_file != '' {
            Exec["git_update_${title}"] {
                creates => $lock_file,
            }
        }

        exec {"git_checkout_${title}":
            command     => "git checkout tags/${git_tag}",
            cwd         => $directory,
            user        => $owner,
            path        => '/usr/bin/',
            refreshonly => true,
        }
    }
}