Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #12266: Handle last RPM sort for more than 10 bootstrap RPMs #83

Merged
merged 1 commit into from
Apr 21, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion lib/puppet/provider/certs_bootstrap_rpm/katello_ssl_tool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the RPM version never change, always 1.0? Could that change some day?

The last RPM ends up as 1.0.11 when we have:

["foo-1.0-1.noarch.rpm", "foo-2.0-2.noarch.rpm", "foo-1.0-11.noarch.rpm"]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK we don't increment the version (https://github.com/Katello/puppet-certs/pull/83/files/e6df6f10f485e0bf283c428c371fa2606b7faaa5#diff-d7c04bc14bf477574cb5d1f4d285675cR13) only the release when we generate a new bootstrap RPM. So possible that logic could change down the road, but I don't forsee it :)

end

def next_release
Expand Down