summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@member.fsf.org>2010-08-20 14:16:51 +0800
committerJames Turnbull <james@lovedthanlost.net>2010-08-20 14:25:11 +0800
commita71777b4ec097954ac58de537685df096d8a8f63 (patch)
tree7b11a86a8b6bbdab853e1be100819e67847708f4
parente984b0810eeeeebe7092cda5eba1310fa928ca5c (diff)
Take into account :latest status in git provider
-rw-r--r--lib/puppet/type/vcsrepo.rb20
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/puppet/type/vcsrepo.rb b/lib/puppet/type/vcsrepo.rb
index ff3624b..8b2d93e 100644
--- a/lib/puppet/type/vcsrepo.rb
+++ b/lib/puppet/type/vcsrepo.rb
@@ -28,13 +28,13 @@ Puppet::Type.newtype(:vcsrepo) do
when :present
return true unless [:absent, :purged, :held].include?(is)
when :latest
- if provider.latest?
+ if is == :latest
return true
else
self.debug "%s repo revision is %s, latest is %s" %
[@resource.name, provider.revision, provider.latest]
return false
- end
+ end
end
end
@@ -70,16 +70,12 @@ Puppet::Type.newtype(:vcsrepo) do
def retrieve
prov = @resource.provider
if prov
- if prov.class.feature?(:bare_repositories)
- if prov.working_copy_exists?
- :present
- elsif prov.bare_exists?
- :bare
- else
- :absent
- end
+ if prov.working_copy_exists?
+ prov.latest? ? :latest : :present
+ elsif prov.class.feature?(:bare_repositories) and prov.bare_exists?
+ :bare
else
- prov.exists? ? :present : :absent
+ :absent
end
else
raise Puppet::Error, "Could not find provider"
@@ -121,4 +117,4 @@ Puppet::Type.newtype(:vcsrepo) do
end
end
-end \ No newline at end of file
+end