diff options
author | Aaron Stone <aaron@serendipity.cx> | 2013-07-19 11:10:29 -0700 |
---|---|---|
committer | Aaron Stone <aaron@serendipity.cx> | 2013-07-19 11:10:29 -0700 |
commit | a91c58531bd308ac71b3a94ea310399a383247ca (patch) | |
tree | ada22fcc1c172caffd450828487188ce46436ff6 /lib/puppet/provider | |
parent | 0fec94345ea9aab7920684f8e383d17d44d553dd (diff) | |
parent | 3b6d1e4ab65e02f11f22f8e611fad9a3f9224593 (diff) |
Merge pull request #82 from webfactory/issue-10791
Allow for setting the CVS_RSH environment variable
Diffstat (limited to 'lib/puppet/provider')
-rw-r--r-- | lib/puppet/provider/vcsrepo/cvs.rb | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/lib/puppet/provider/vcsrepo/cvs.rb b/lib/puppet/provider/vcsrepo/cvs.rb index 6dc7882..0603017 100644 --- a/lib/puppet/provider/vcsrepo/cvs.rb +++ b/lib/puppet/provider/vcsrepo/cvs.rb @@ -4,7 +4,7 @@ Puppet::Type.type(:vcsrepo).provide(:cvs, :parent => Puppet::Provider::Vcsrepo) desc "Supports CVS repositories/workspaces" optional_commands :cvs => 'cvs' - has_features :gzip_compression, :reference_tracking, :modules + has_features :gzip_compression, :reference_tracking, :modules, :cvs_rsh def create if !@resource.value(:source) @@ -38,7 +38,7 @@ Puppet::Type.type(:vcsrepo).provide(:cvs, :parent => Puppet::Provider::Vcsrepo) # We cannot use -P to prune empty dirs, otherwise # CVS would report those as "missing", regardless # if they have contents or updates. - is_current = (cvs('-nq', 'update', '-d').strip == "") + is_current = (runcvs('-nq', 'update', '-d').strip == "") if (!is_current) then debug "There are updates available on the checkout's current branch/tag." end return is_current end @@ -69,7 +69,7 @@ Puppet::Type.type(:vcsrepo).provide(:cvs, :parent => Puppet::Provider::Vcsrepo) def revision=(desired) at_path do - cvs('update', '-dr', desired, '.') + runcvs('update', '-dr', desired, '.') update_owner @rev = desired end @@ -93,7 +93,7 @@ Puppet::Type.type(:vcsrepo).provide(:cvs, :parent => Puppet::Provider::Vcsrepo) args.push('-r', @resource.value(:revision)) end args.push('-d', basename, module_name) - cvs(*args) + runcvs(*args) end end @@ -108,7 +108,7 @@ Puppet::Type.type(:vcsrepo).provide(:cvs, :parent => Puppet::Provider::Vcsrepo) end def create_repository(path) - cvs('-d', path, 'init') + runcvs('-d', path, 'init') end def update_owner @@ -116,4 +116,18 @@ Puppet::Type.type(:vcsrepo).provide(:cvs, :parent => Puppet::Provider::Vcsrepo) set_ownership end end + + def runcvs(*args) + if @resource.value(:cvs_rsh) + debug "Using CVS_RSH = " + @resource.value(:cvs_rsh) + e = { :CVS_RSH => @resource.value(:cvs_rsh) } + else + e = {} + end + + Puppet::Util::Execution.withenv e do + Puppet.debug cvs *args + end + end + end |