diff options
Diffstat (limited to 'lib/puppet/provider')
-rw-r--r-- | lib/puppet/provider/vcsrepo/git.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/puppet/provider/vcsrepo/git.rb b/lib/puppet/provider/vcsrepo/git.rb index 000032e..8074950 100644 --- a/lib/puppet/provider/vcsrepo/git.rb +++ b/lib/puppet/provider/vcsrepo/git.rb @@ -5,7 +5,7 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo) commands :git => 'git' - has_features :bare_repositories, :reference_tracking, :ssh_identity, :multiple_remotes, :user, :depth, :submodules + has_features :bare_repositories, :reference_tracking, :ssh_identity, :multiple_remotes, :user, :depth, :branch, :submodules def create if @resource.value(:revision) and @resource.value(:ensure) == :bare @@ -75,7 +75,7 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo) at_path { git_with_identity('reset', '--hard', "#{@resource.value(:remote)}/#{desired}") } end #TODO Would this ever reach here if it is bare? - if @resource.value(:ensure) != :bare + if @resource.value(:ensure) != :bare && @resource.value(:submodules) == :true update_submodules end update_owner_and_excludes @@ -180,6 +180,12 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo) args = ['clone'] if @resource.value(:depth) and @resource.value(:depth).to_i > 0 args.push('--depth', @resource.value(:depth).to_s) + if @resource.value(:revision) + args.push('--branch', @resource.value(:revision).to_s) + end + end + if @resource.value(:branch) + args.push('--branch', @resource.value(:branch).to_s) end if @resource.value(:ensure) == :bare args << '--bare' @@ -415,7 +421,7 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo) # @!visibility private def git_with_identity(*args) if @resource.value(:identity) - Tempfile.open('git-helper') do |f| + Tempfile.open('git-helper', Puppet[:statedir]) do |f| f.puts '#!/bin/sh' f.puts "exec ssh -oStrictHostKeyChecking=no -oPasswordAuthentication=no -oKbdInteractiveAuthentication=no -oChallengeResponseAuthentication=no -oConnectTimeout=120 -i #{@resource.value(:identity)} $*" f.close |