1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

B #4903: Avoid backticks (#436)

Co-authored-by: Daniel Clavijo Coca <dclavijo@opennebula.io>
This commit is contained in:
Daniel Clavijo Coca 2020-11-17 10:34:46 -06:00 committed by GitHub
parent 5d98f40a87
commit 5b030d2869
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,7 +16,6 @@
require 'shellwords'
require 'open3'
require 'English'
################################################################################
# The VNMMAD module provides the basic abstraction to implement custom
@ -217,10 +216,11 @@ module VNMMAD
# Checks wether a NIC exist or not. Returns true/false and the NIC info
def nic_exist?(name)
text = `#{command(:ip)} link show #{name}`
status = $CHILD_STATUS.exitstatus
cmd = "#{command(:ip)} link show #{name}"
return true, text if status == 0
_o, _e, s = Open3.capture3(cmd)
return true, text if s.exitstatus.zero?
[false, text]
end