Merge "fix getting the release name with lsb release"
This commit is contained in:
commit
9d4234aaf5
@ -55,22 +55,19 @@ when 'rhel'
|
||||
|
||||
when 'suse'
|
||||
if node['lsb']['description'].nil?
|
||||
# Workaround for SLE11
|
||||
#
|
||||
# On SLE11 ohai is broken and prefers lsb-release. We need to
|
||||
# install it to be able to detect if recipe is run on openSUSE or SLES.
|
||||
#
|
||||
# https://bugzilla.novell.com/show_bug.cgi?id=809129
|
||||
#
|
||||
#
|
||||
install_lsb_release = package 'lsb-release' do
|
||||
action :nothing
|
||||
# Ohai lsb does not work at all on SLES11SP3
|
||||
# See https://tickets.opscode.com/browse/OHAI-454
|
||||
# Until then, copy chef's lsb_release parsing code from its lsb module.
|
||||
package 'lsb-release'
|
||||
|
||||
Mixlib::ShellOut.new('lsb_release -a').run_command.stdout.split("\n").each do |line|
|
||||
case line
|
||||
when /^Description:\s+(.+)$/
|
||||
node.set_unless['lsb']['description'] = Regexp.last_match[1]
|
||||
when /^Release:\s+(.+)$/
|
||||
node.set_unless['lsb']['release'] = Regexp.last_match[1]
|
||||
end
|
||||
end
|
||||
reload_ohai = ohai 'reload_lsb' do
|
||||
action :nothing
|
||||
end
|
||||
install_lsb_release.run_action(:install)
|
||||
reload_ohai.run_action(:reload)
|
||||
end
|
||||
if node['lsb']['description'][/^SUSE Linux Enterprise Server/]
|
||||
release, patchlevel = node['platform_version'].split('.')
|
||||
|
Loading…
Reference in New Issue
Block a user