Skip to content

Commit

Permalink
Refs #12266 - fixing case where no certs exist
Browse files Browse the repository at this point in the history
undefined method [] for nil:NilClass
/usr/share/katello-installer-base/modules/certs/lib/puppet/provider/certs_bootstrap_rpm/katello_ssl_tool.rb:46:in last_rpm
  • Loading branch information
jlsherrill committed Apr 27, 2016
1 parent ace030f commit f6f3a54
Showing 1 changed file with 4 additions and 3 deletions.
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
end

def next_release
Expand Down

0 comments on commit f6f3a54

Please sign in to comment.