diff options
author | Ashley Penney <ashley.penney@puppetlabs.com> | 2014-04-03 13:57:48 -0400 |
---|---|---|
committer | Ashley Penney <ashley.penney@puppetlabs.com> | 2014-04-03 13:57:48 -0400 |
commit | 1e0f7c6427d6aef7cef9a9e2822925b8a7f4f862 (patch) | |
tree | b71f903616f2de4e6f7d7ac60b9f23f34de9f258 /lib/puppet | |
parent | a388ce3f1f734a909101c1995202ae123bee0668 (diff) | |
parent | 744f3cc4094062ef1f6a80c644d82b6284d2f7fc (diff) | |
download | puppet-vcsrepo-1e0f7c6427d6aef7cef9a9e2822925b8a7f4f862.tar.gz puppet-vcsrepo-1e0f7c6427d6aef7cef9a9e2822925b8a7f4f862.tar.bz2 |
Merge pull request #121 from fkrull/master
Only add ssh options to commands that actually talk to the network.
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/provider/vcsrepo/hg.rb | 11 |
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 |