Commit 6e85c271 authored by Jesai Langenbach's avatar Jesai Langenbach Committed by Bryan McLellan
Browse files

Added Commandline for Old zypper Version

Ticket:if CHEF-2129
parent b67e8983
......@@ -84,9 +84,18 @@ class Chef
Chef::Log.debug("zypper current resource #{@current_resource}")
@current_resource
end
#Gets the zypper Version from command output (Returns Floating Point number)
def zypper_version()
`zypper -V 2>&1`.scan(/\d+/).join(".").to_f
end
def install_package(name, version)
if version
if zypper_version < 1.0
run_command(
:command => "zypper install -y #{name}"
)
elsif version
run_command(
:command => "zypper -n --no-gpg-checks install -l #{name}=#{version}"
)
......@@ -98,7 +107,11 @@ class Chef
end
def upgrade_package(name, version)
if version
if zypper_version < 1.0
run_command(
:command => "zypper install -y #{name}"
)
elsif version
run_command(
:command => "zypper -n --no-gpg-checks install -l #{name}=#{version}"
)
......@@ -110,7 +123,11 @@ class Chef
end
def remove_package(name, version)
if version
if zypper_version < 1.0
run_command(
:command => "zypper remove -y #{name}"
)
elsif version
run_command(
:command => "zypper -n --no-gpg-checks remove #{name}=#{version}"
)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment