summaryrefslogtreecommitdiff
path: root/lib/puppet/provider/vcsrepo/git.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/provider/vcsrepo/git.rb')
-rw-r--r--lib/puppet/provider/vcsrepo/git.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/puppet/provider/vcsrepo/git.rb b/lib/puppet/provider/vcsrepo/git.rb
index dde9bf0..49ac648 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
@@ -142,7 +142,8 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo)
# we loop around the hash. Otherwise, we assume single url specified
# in source property
if @resource.value(:source).is_a?(Hash)
- @resource.value(:source).each do |remote_name, remote_url|
+ @resource.value(:source).keys.sort.each do |remote_name|
+ remote_url = @resource.value(:source)[remote_name]
at_path { do_update |= update_remote_url(remote_name, remote_url) }
end
else
@@ -180,6 +181,9 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo)
if @resource.value(:depth) and @resource.value(:depth).to_i > 0
args.push('--depth', @resource.value(:depth).to_s)
end
+ if @resource.value(:branch)
+ args.push('--branch', @resource.value(:branch).to_s)
+ end
if @resource.value(:ensure) == :bare
args << '--bare'
end
@@ -414,7 +418,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