Add support for master svn repositories
author5Ub-Z3r0 <5ub-z3r0@nikorasu.net>
Wed, 10 Oct 2012 14:38:03 +0000 (17:38 +0300)
committerAaron Stone <aaron@serendipity.cx>
Fri, 19 Jul 2013 19:44:23 +0000 (12:44 -0700)
Pull request related to┬áissue #8331.
I have added support into the exists? method (actually working_copy_exists?) for checking if the path is a master repository, using svnlook. It should be ok in most cases, since svnlook comes with svnadmin in nearly every distribution.

lib/puppet/provider/vcsrepo/svn.rb
spec/unit/puppet/provider/vcsrepo/svn_spec.rb

index 7485ff5..0c911bf 100644 (file)
@@ -4,7 +4,8 @@ Puppet::Type.type(:vcsrepo).provide(:svn, :parent => Puppet::Provider::Vcsrepo)
   desc "Supports Subversion repositories"
 
   optional_commands :svn      => 'svn',
-                    :svnadmin => 'svnadmin'
+                    :svnadmin => 'svnadmin',
+                    :svnlook  => 'svnlook'
 
   has_features :filesystem_types, :reference_tracking, :basic_auth, :configuration
 
@@ -20,7 +21,15 @@ Puppet::Type.type(:vcsrepo).provide(:svn, :parent => Puppet::Provider::Vcsrepo)
   end
 
   def working_copy_exists?
-    File.directory?(File.join(@resource.value(:path), '.svn'))
+    if File.directory?(@resource.value(:path))
+      if File.directory?(File.join(@resource.value(:path), '.svn'))
+        return true
+      end
+      if svnlook('uuid',@resource.value(:path))
+        return true
+      end
+    end
+    return false
   end
 
   def exists?
index 75d58f9..a533b7c 100644 (file)
@@ -49,6 +49,7 @@ describe_provider :vcsrepo, :svn, :resource => {:path => '/tmp/vcsrepo'} do
 
   describe "checking existence" do
     it "should check for the directory" do
+      expects_directory?(true, resource.value(:path))
       expects_directory?(true, File.join(resource.value(:path), '.svn'))
       provider.exists?
     end