Skip to content

Commit

Permalink
don't use before if ensure != latest
Browse files Browse the repository at this point in the history
  • Loading branch information
Southparkfan committed Aug 2, 2017
1 parent 369841b commit 3f0ce9a
Showing 1 changed file with 28 additions and 12 deletions.
40 changes: 28 additions & 12 deletions modules/git/manifests/clone.pp
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,34 @@
}

if $branch {
exec { "git_checkout_${title}":
cwd => $directory,
command => "${git} checkout ${branch}",
provider => shell,
environment => $env,
unless => "${git} rev-parse --abbrev-ref HEAD | grep ${branch}",
user => $owner,
group => $group,
umask => $umask,
path => '/usr/bin:/bin',
require => Exec["git_clone_${title}"],
before => Exec["git_pull_${title}"],
if $ensure == 'latest' {
exec { "git_checkout_${title}":
cwd => $directory,
command => "${git} checkout ${branch}",
provider => shell,
environment => $env,
unless => "${git} rev-parse --abbrev-ref HEAD | grep ${branch}",
user => $owner,
group => $group,
umask => $umask,
path => '/usr/bin:/bin',
require => Exec["git_clone_${title}"],
before => Exec["git_pull_${title}"],
}
}
else {
exec { "git_checkout_${title}":
cwd => $directory,
command => "${git} checkout ${branch}",
provider => shell,
environment => $env,
unless => "${git} rev-parse --abbrev-ref HEAD | grep ${branch}",
user => $owner,
group => $group,
umask => $umask,
path => '/usr/bin:/bin',
require => Exec["git_clone_${title}"],
}
}
}

Expand Down

0 comments on commit 3f0ce9a

Please sign in to comment.