change path_empty? to not do full directory listing
authorJohn Iacona <jiacona@genarts.com>
Wed, 28 Aug 2013 20:34:57 +0000 (16:34 -0400)
committerJohn Iacona <jiacona@genarts.com>
Wed, 28 Aug 2013 20:34:57 +0000 (16:34 -0400)
lib/puppet/provider/vcsrepo.rb

index 05b92f8..8793e63 100644 (file)
@@ -19,7 +19,10 @@ class Puppet::Provider::Vcsrepo < Puppet::Provider
 
   def path_empty?
     # Path is empty if the only entries are '.' and '..'
-    Dir.entries(@resource.value(:path)).size == 2
+    d = Dir.new(@resource.value(:path))
+    d.read # should return '.'
+    d.read # should return '..'
+    d.read.nil?
   end
 
   # Note: We don't rely on Dir.chdir's behavior of automatically returning the