diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/provider/vcsrepo/git.rb | 4 | ||||
-rw-r--r-- | lib/puppet/provider/vcsrepo/hg.rb | 12 | ||||
-rw-r--r-- | lib/puppet/type/vcsrepo.rb | 14 |
3 files changed, 16 insertions, 14 deletions
diff --git a/lib/puppet/provider/vcsrepo/git.rb b/lib/puppet/provider/vcsrepo/git.rb index 5c878ed..5c5dd07 100644 --- a/lib/puppet/provider/vcsrepo/git.rb +++ b/lib/puppet/provider/vcsrepo/git.rb @@ -52,7 +52,9 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo) return current unless @resource.value(:revision) if tag_revision?(@resource.value(:revision)) - canonical = at_path { git_with_identity('rev-parse', @resource.value(:revision)).chomp } + # git-rev-parse will give you the hash of the tag object itself rather than the commit it points to by default. + # Using tag^0 will return the actual commit. + canonical = at_path { git_with_identity('rev-parse', "#{@resource.value(:revision)}^0").chomp } else # if it's not a tag, look for it as a local ref canonical = at_path { git_with_identity('rev-parse', '--revs-only', @resource.value(:revision)).chomp } 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 diff --git a/lib/puppet/type/vcsrepo.rb b/lib/puppet/type/vcsrepo.rb index 7ada022..f678389 100644 --- a/lib/puppet/type/vcsrepo.rb +++ b/lib/puppet/type/vcsrepo.rb @@ -101,9 +101,8 @@ Puppet::Type.newtype(:vcsrepo) do if prov if prov.working_copy_exists? if @resource.value(:force) - if noop? - notice "Noop Mode - Would have deleted repository" - notice "Noop Mode - Would have created repository from latest" + if noop + notice "Noop Mode - Would have deleted repository and re-created from latest" else notice "Deleting current repository before recloning" prov.destroy @@ -219,13 +218,4 @@ Puppet::Type.newtype(:vcsrepo) do autorequire(:package) do ['git', 'git-core'] end - - def noop? - if defined?(@noop) - @noop - else - Puppet[:noop] - end - end - end |