Take into account :latest status in git provider

This commit is contained in:
Aleksey Lim 2010-08-20 14:16:51 +08:00 committed by James Turnbull
parent e984b0810e
commit a71777b4ec
1 changed files with 8 additions and 12 deletions

View File

@ -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
end