summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Iacona <jiacona@genarts.com>2013-08-28 16:34:57 -0400
committerJohn Iacona <jiacona@genarts.com>2013-08-28 16:34:57 -0400
commite69c6eac89fbbbd5c459388eef30b1320ab9d826 (patch)
tree76695dbd58b05abee4dd8a5dba25742aff83c0d3
parent411111b5ff88b682d7e9cc54a47573bccc3e3edc (diff)
downloadpuppet-vcsrepo-e69c6eac89fbbbd5c459388eef30b1320ab9d826.tar.gz
puppet-vcsrepo-e69c6eac89fbbbd5c459388eef30b1320ab9d826.tar.bz2
change path_empty? to not do full directory listing
-rw-r--r--lib/puppet/provider/vcsrepo.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/puppet/provider/vcsrepo.rb b/lib/puppet/provider/vcsrepo.rb
index 05b92f8..8793e63 100644
--- a/lib/puppet/provider/vcsrepo.rb
+++ b/lib/puppet/provider/vcsrepo.rb
@@ -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