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

Refs #12266 - fixing case where no certs exist #86

Merged
merged 1 commit into from
Apr 28, 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
7 changes: 4 additions & 3 deletions lib/puppet/provider/certs_bootstrap_rpm/katello_ssl_tool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ def run
'--requires', 'subscription-manager',
'--post', post_script_file,
*resource[:files])
if resource[:alias]
if (rpm = last_rpm) && resource[:alias]
File.delete(resource[:alias]) if File.exists?(resource[:alias])
File.symlink(last_rpm, resource[:alias])
File.symlink(rpm, resource[:alias])
end
system('/sbin/restorecon ./*.rpm')
end
Expand All @@ -43,7 +43,8 @@ def last_rpm
{'release' => release, 'rpm' => rpm}
end

rpms.sort { |a,b| a['release'].to_i <=> b['release'].to_i }.last['rpm']
rpm = rpms.sort { |a,b| a['release'].to_i <=> b['release'].to_i }.last
rpm['rpm'] if rpm
Copy link
Member

Choose a reason for hiding this comment

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

I think this will cause an error above - when we make the symlink on L25. Probably need to gate that with a last_rpm.blank? check

Copy link
Contributor Author

Choose a reason for hiding this comment

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

based on what it used to be: https://github.com/Katello/puppet-certs/pull/83/files it seems like it handles nil okay, but i can skip up above if its nill to be more explicit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually after testing File.symlink() does not like nil. How was this working before? very strange

end

def next_release
Expand Down