summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Krull <f_krull@gmx.de>2014-02-14 22:12:42 +0100
committerFelix Krull <f_krull@gmx.de>2014-02-16 21:48:34 +0100
commit744f3cc4094062ef1f6a80c644d82b6284d2f7fc (patch)
tree59b6d804e2ad08e065d8f7b78a1ec88252ced749
parent50079b58192ed7a2af1ba6756f75084bc74d33e8 (diff)
downloadpuppet-vcsrepo-744f3cc4094062ef1f6a80c644d82b6284d2f7fc.tar.gz
puppet-vcsrepo-744f3cc4094062ef1f6a80c644d82b6284d2f7fc.tar.bz2
Only add ssh options to commands that actually talk to the network.
At least in Mercurial 2.8.2, --ssh seems to be a command-specific parameter in contrast to a global one. As a result, local commands error when seeing a --ssh parameter. This change passes --ssh only for commands that actually talk to the network ('incoming', 'pull' and 'clone' here).
-rw-r--r--lib/puppet/provider/vcsrepo/hg.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/puppet/provider/vcsrepo/hg.rb b/lib/puppet/provider/vcsrepo/hg.rb
index 33f1e6a..6c6f936 100644
--- a/lib/puppet/provider/vcsrepo/hg.rb
+++ b/lib/puppet/provider/vcsrepo/hg.rb
@@ -37,7 +37,7 @@ Puppet::Type.type(:vcsrepo).provide(:hg, :parent => Puppet::Provider::Vcsrepo) d
def latest
at_path do
begin
- hg_wrapper('incoming', '--branch', '.', '--newest-first', '--limit', '1')[/^changeset:\s+(?:-?\d+):(\S+)/m, 1]
+ hg_wrapper('incoming', '--branch', '.', '--newest-first', '--limit', '1', { :remote => true })[/^changeset:\s+(?:-?\d+):(\S+)/m, 1]
rescue Puppet::ExecutionFailure
# If there are no new changesets, return the current nodeid
self.revision
@@ -66,7 +66,7 @@ Puppet::Type.type(:vcsrepo).provide(:hg, :parent => Puppet::Provider::Vcsrepo) d
def revision=(desired)
at_path do
begin
- hg_wrapper('pull')
+ hg_wrapper('pull', { :remote => true })
rescue
end
begin
@@ -92,6 +92,7 @@ Puppet::Type.type(:vcsrepo).provide(:hg, :parent => Puppet::Provider::Vcsrepo) d
end
args.push(@resource.value(:source),
@resource.value(:path))
+ args.push({ :remote => true })
hg_wrapper(*args)
end
@@ -102,7 +103,11 @@ Puppet::Type.type(:vcsrepo).provide(:hg, :parent => Puppet::Provider::Vcsrepo) d
end
def hg_wrapper(*args)
- if @resource.value(:identity)
+ options = { :remote => false }
+ if args.length > 0 and args[-1].is_a? Hash
+ options.merge!(args.pop)
+ end
+ if options[:remote] and @resource.value(:identity)
args += ["--ssh", "ssh -oStrictHostKeyChecking=no -oPasswordAuthentication=no -oKbdInteractiveAuthentication=no -oChallengeResponseAuthentication=no -i #{@resource.value(:identity)}"]
end
if @resource.value(:user) and @resource.value(:user) != Facter['id'].value