From 7845ea132b0b40a83d3e9284723cbf63e2b61a82 Mon Sep 17 00:00:00 2001 From: Miguel Di Ciurcio Filho Date: Sat, 11 Jan 2014 15:25:28 -0200 Subject: git: actually use the remote parameter When using the following sample, the provider does not use the value of remote when cloning a repository: vcsrepo {'/path/to/repo': ensure => 'present', provider => 'git', remote => 'test', source => 'git@somerepo:repo.git', } $ git remote origin This commit makes sure that the new repository has a remote with the supplied value. Closes #MODULES-430 --- lib/puppet/provider/vcsrepo/git.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/puppet/provider/vcsrepo') diff --git a/lib/puppet/provider/vcsrepo/git.rb b/lib/puppet/provider/vcsrepo/git.rb index af38a59..cdae459 100644 --- a/lib/puppet/provider/vcsrepo/git.rb +++ b/lib/puppet/provider/vcsrepo/git.rb @@ -105,10 +105,10 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo) end def update_remote_origin_url - current = git_with_identity('config', 'remote.origin.url') + current = git_with_identity('config', "remote.#{@resource.value(:remote)}.url") unless @resource.value(:source).nil? if current.nil? or current.strip != @resource.value(:source) - git_with_identity('config', 'remote.origin.url', @resource.value(:source)) + git_with_identity('config', "remote.#{@resource.value(:remote)}.url", @resource.value(:source)) end end end @@ -137,6 +137,9 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo) if @resource.value(:ensure) == :bare args << '--bare' end + if @resource.value(:remote) != 'origin' + args.push('--origin', @resource.value(:remote)) + end if !File.exist?(File.join(@resource.value(:path), '.git')) args.push(source, path) Dir.chdir("/") do -- cgit v1.2.3