diff options
-rw-r--r-- | lib/puppet/provider/vcsrepo/git.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/puppet/provider/vcsrepo/git.rb b/lib/puppet/provider/vcsrepo/git.rb index 804c740..80fa2f0 100644 --- a/lib/puppet/provider/vcsrepo/git.rb +++ b/lib/puppet/provider/vcsrepo/git.rb @@ -187,9 +187,12 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo) private - # @!visibility private + def valid_repo? + Dir.chdir(@resource.value(:path)){ system('git rev-parse > /dev/null 2>&1')} + end + def bare_git_config_exists? - File.exist?(File.join(@resource.value(:path), 'config')) + File.exist?(File.join(@resource.value(:path), 'config')) && valid_repo? end # @!visibility private @@ -227,7 +230,7 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo) # @!visibility private def check_force if path_exists? and not path_empty? - if @resource.value(:force) + if @resource.value(:force) && !valid_repo? notice "Removing %s to replace with vcsrepo." % @resource.value(:path) destroy else |