summaryrefslogtreecommitdiff
path: root/lib/puppet/provider/vcsrepo
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/provider/vcsrepo')
-rw-r--r--lib/puppet/provider/vcsrepo/bzr.rb8
-rw-r--r--lib/puppet/provider/vcsrepo/cvs.rb12
-rw-r--r--lib/puppet/provider/vcsrepo/git.rb4
-rw-r--r--lib/puppet/provider/vcsrepo/hg.rb2
-rw-r--r--lib/puppet/provider/vcsrepo/svn.rb2
5 files changed, 20 insertions, 8 deletions
diff --git a/lib/puppet/provider/vcsrepo/bzr.rb b/lib/puppet/provider/vcsrepo/bzr.rb
index a060562..3a93e35 100644
--- a/lib/puppet/provider/vcsrepo/bzr.rb
+++ b/lib/puppet/provider/vcsrepo/bzr.rb
@@ -3,7 +3,7 @@ require File.join(File.dirname(__FILE__), '..', 'vcsrepo')
Puppet::Type.type(:vcsrepo).provide(:bzr, :parent => Puppet::Provider::Vcsrepo) do
desc "Supports Bazaar repositories"
- commands :bzr => 'bzr'
+ optional_commands :bzr => 'bzr'
defaultfor :bzr => :exists
has_features :reference_tracking
@@ -15,10 +15,14 @@ Puppet::Type.type(:vcsrepo).provide(:bzr, :parent => Puppet::Provider::Vcsrepo)
end
end
- def exists?
+ def working_copy_exists?
File.directory?(File.join(@resource.value(:path), '.bzr'))
end
+ def exists?
+ working_copy_exists?
+ end
+
def destroy
FileUtils.rm_rf(@resource.value(:path))
end
diff --git a/lib/puppet/provider/vcsrepo/cvs.rb b/lib/puppet/provider/vcsrepo/cvs.rb
index e82c23a..f504cb1 100644
--- a/lib/puppet/provider/vcsrepo/cvs.rb
+++ b/lib/puppet/provider/vcsrepo/cvs.rb
@@ -3,9 +3,9 @@ require File.join(File.dirname(__FILE__), '..', 'vcsrepo')
Puppet::Type.type(:vcsrepo).provide(:cvs, :parent => Puppet::Provider::Vcsrepo) do
desc "Supports CVS repositories/workspaces"
- commands :cvs => 'cvs'
+ optional_commands :cvs => 'cvs'
defaultfor :cvs => :exists
- has_features :gzip_compression, :reference_tracking
+ has_features :gzip_compression, :reference_tracking, :modules
def create
if !@resource.value(:source)
@@ -24,6 +24,10 @@ Puppet::Type.type(:vcsrepo).provide(:cvs, :parent => Puppet::Provider::Vcsrepo)
File.directory?(directory)
end
+ def working_copy_exists?
+ File.directory?(File.join(@resource.value(:path), 'CVS'))
+ end
+
def destroy
FileUtils.rm_rf(@resource.value(:path))
end
@@ -68,7 +72,9 @@ Puppet::Type.type(:vcsrepo).provide(:cvs, :parent => Puppet::Provider::Vcsrepo)
# When the source:
# * Starts with ':' (eg, :pserver:...)
def module_name
- if (source = @resource.value(:source))
+ if (m = @resource.value(:module))
+ m
+ elsif (source = @resource.value(:source))
source[0, 1] == ':' ? File.basename(source) : '.'
end
end
diff --git a/lib/puppet/provider/vcsrepo/git.rb b/lib/puppet/provider/vcsrepo/git.rb
index 6756fc0..6cbda67 100644
--- a/lib/puppet/provider/vcsrepo/git.rb
+++ b/lib/puppet/provider/vcsrepo/git.rb
@@ -4,7 +4,7 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo)
desc "Supports Git repositories"
##TODO modify the commands below so that the su - is included
- commands :git => 'git'
+ optional_commands :git => 'git'
defaultfor :git => :exists
has_features :bare_repositories, :reference_tracking, :ssh_identity
@@ -96,6 +96,7 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo)
def update_references
at_path do
git_with_identity('fetch', '--tags', 'origin')
+ update_owner_and_excludes
end
end
@@ -262,6 +263,7 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo)
end
current = @resource.value(:revision) if current == canonical
end
+ update_owner_and_excludes
return current
end
diff --git a/lib/puppet/provider/vcsrepo/hg.rb b/lib/puppet/provider/vcsrepo/hg.rb
index f967586..54205c2 100644
--- a/lib/puppet/provider/vcsrepo/hg.rb
+++ b/lib/puppet/provider/vcsrepo/hg.rb
@@ -3,7 +3,7 @@ require File.join(File.dirname(__FILE__), '..', 'vcsrepo')
Puppet::Type.type(:vcsrepo).provide(:hg, :parent => Puppet::Provider::Vcsrepo) do
desc "Supports Mercurial repositories"
- commands :hg => 'hg'
+ optional_commands :hg => 'hg'
defaultfor :hg => :exists
has_features :reference_tracking
diff --git a/lib/puppet/provider/vcsrepo/svn.rb b/lib/puppet/provider/vcsrepo/svn.rb
index 6ec4612..bd420b5 100644
--- a/lib/puppet/provider/vcsrepo/svn.rb
+++ b/lib/puppet/provider/vcsrepo/svn.rb
@@ -3,7 +3,7 @@ require File.join(File.dirname(__FILE__), '..', 'vcsrepo')
Puppet::Type.type(:vcsrepo).provide(:svn, :parent => Puppet::Provider::Vcsrepo) do
desc "Supports Subversion repositories"
- commands :svn => 'svn',
+ optional_commands :svn => 'svn',
:svnadmin => 'svnadmin'
defaultfor :svn => :exists