mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-25 02:50:08 +03:00
M #: catch iptables version command exceptions (#2223)
This commit is contained in:
parent
89ce359739
commit
8103c4bceb
@ -38,14 +38,17 @@ module VNMMAD
|
||||
:ipset => 'sudo -n ipset'
|
||||
}
|
||||
|
||||
# Adjust :ip[6]tables commands to work with legacy version
|
||||
stdout = Open3.capture3('sudo iptables --version')[0]
|
||||
regex = /.*v(?<version>\d+.\d+.\d+)/
|
||||
iptables_version = Gem::Version.new(stdout.match(regex)[:version])
|
||||
# Adjust :ip[6]tables commands to work with legacy versions
|
||||
begin
|
||||
stdout = Open3.capture3('sudo iptables --version')[0]
|
||||
regex = /.*v(?<version>\d+.\d+.\d+)/
|
||||
iptables_version = Gem::Version.new(stdout.match(regex)[:version])
|
||||
|
||||
if Gem::Version.new('1.6.1') > iptables_version
|
||||
COMMANDS[:iptables] = 'sudo -n iptables -w 3'
|
||||
COMMANDS[:ip6tables] = 'sudo -n ip6tables -w 3'
|
||||
if Gem::Version.new('1.6.1') > iptables_version
|
||||
COMMANDS[:iptables] = 'sudo -n iptables -w 3'
|
||||
COMMANDS[:ip6tables] = 'sudo -n ip6tables -w 3'
|
||||
end
|
||||
rescue StandardError
|
||||
end
|
||||
|
||||
# Represents an Array of commands to be executed by the networking
|
||||
|
Loading…
x
Reference in New Issue
Block a user