summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/puppet/provider/vcsrepo/cvs.rb24
-rw-r--r--lib/puppet/type/vcsrepo.rb7
2 files changed, 26 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
diff --git a/lib/puppet/type/vcsrepo.rb b/lib/puppet/type/vcsrepo.rb
index fc20f75..3281508 100644
--- a/lib/puppet/type/vcsrepo.rb
+++ b/lib/puppet/type/vcsrepo.rb
@@ -34,6 +34,9 @@ Puppet::Type.newtype(:vcsrepo) do
feature :configuration,
"The configuration directory to use"
+ feature :cvs_rsh,
+ "The provider understands the CVS_RSH environment variable"
+
ensurable do
attr_accessor :latest
@@ -184,4 +187,8 @@ Puppet::Type.newtype(:vcsrepo) do
desc "The configuration directory to use"
end
+ newparam :cvs_rsh, :required_features => [:cvs_rsh] do
+ desc "The value to be used for the CVS_RSH environment variable."
+ end
+
end