summaryrefslogtreecommitdiff
path: root/lib/puppet/provider
diff options
context:
space:
mode:
authorStuart Whelan <stuart@somepointinthefuture.co.nz>2014-06-21 17:26:14 +1200
committerAaron Stone <aaron@serendipity.cx>2014-06-23 14:57:46 -0700
commit2ff03cff1795d3e43c922f7bceb235ce69175013 (patch)
treed901938009082ea30fc23762a9692ff0b331a61c /lib/puppet/provider
parente42310c7fb082a20f4155d801e41b980400ae045 (diff)
downloadpuppet-vcsrepo-2ff03cff1795d3e43c922f7bceb235ce69175013.tar.gz
puppet-vcsrepo-2ff03cff1795d3e43c922f7bceb235ce69175013.tar.bz2
Added support for basic authentication to hg provider
Updated unit tests Updated hg readme and added examples
Diffstat (limited to 'lib/puppet/provider')
-rw-r--r--lib/puppet/provider/vcsrepo/hg.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/puppet/provider/vcsrepo/hg.rb b/lib/puppet/provider/vcsrepo/hg.rb
index 56ca527..090f019 100644
--- a/lib/puppet/provider/vcsrepo/hg.rb
+++ b/lib/puppet/provider/vcsrepo/hg.rb
@@ -6,7 +6,7 @@ Puppet::Type.type(:vcsrepo).provide(:hg, :parent => Puppet::Provider::Vcsrepo) d
commands :hg => 'hg'
optional_commands :su => 'su'
- has_features :reference_tracking, :ssh_identity, :user
+ has_features :reference_tracking, :ssh_identity, :user, :basic_auth
def create
if !@resource.value(:source)
@@ -108,6 +108,16 @@ Puppet::Type.type(:vcsrepo).provide(:hg, :parent => Puppet::Provider::Vcsrepo) d
if args.length > 0 and args[-1].is_a? Hash
options.merge!(args.pop)
end
+
+ if @resource.value(:basic_auth_username) && @resource.value(:basic_auth_password)
+ args += [
+ "--config", "\"auth.x.prefix=#{@resource.value(:source)}\"",
+ "--config", "\"auth.x.username=#{@resource.value(:basic_auth_username)}\"",
+ "--config", "\"auth.x.password=#{@resource.value(:basic_auth_password)}\"",
+ "--config", "\"auth.x.schemes=http https\""
+ ]
+ end
+
if options[:remote] and @resource.value(:identity)
args += ["--ssh", "ssh -oStrictHostKeyChecking=no -oPasswordAuthentication=no -oKbdInteractiveAuthentication=no -oChallengeResponseAuthentication=no -i #{@resource.value(:identity)}"]
end