diff --git a/lib/puppet/provider/certs_bootstrap_rpm/katello_ssl_tool.rb b/lib/puppet/provider/certs_bootstrap_rpm/katello_ssl_tool.rb index 3a47922a..56f3d645 100644 --- a/lib/puppet/provider/certs_bootstrap_rpm/katello_ssl_tool.rb +++ b/lib/puppet/provider/certs_bootstrap_rpm/katello_ssl_tool.rb @@ -33,7 +33,17 @@ def run protected def last_rpm - Dir.glob(File.join(resource[:dir], "#{resource[:name]}-*.noarch.rpm")).sort.last + rpms = Dir.glob(File.join(resource[:dir], "#{resource[:name]}-*.noarch.rpm")) + + rpms = rpms.collect do |rpm| + rpm_split = rpm.split("#{resource[:name]}-")[1].split('.noarch.rpm')[0] + version = rpm_split.split('-')[0] + release = rpm_split.split('-')[1] + + {'release' => release, 'rpm' => rpm} + end + + rpms.sort { |a,b| a['release'].to_i <=> b['release'].to_i }.last end def next_release