diff --git a/src/vnm_mad/remotes/lib/command.rb b/src/vnm_mad/remotes/lib/command.rb index 419d14746c..7f047776c6 100644 --- a/src/vnm_mad/remotes/lib/command.rb +++ b/src/vnm_mad/remotes/lib/command.rb @@ -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(?\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(?\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