mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
M #-: Escape shell commands in VN drivers (#1025)
(cherry picked from commit 04b83c9a114af7decf41e5f4d543d13705f9009c)
This commit is contained in:
parent
efa6478bbf
commit
2ab0fa2943
@ -14,6 +14,8 @@
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
require 'shellwords'
|
||||
|
||||
module OpenNebula
|
||||
|
||||
# Generic log function
|
||||
@ -76,6 +78,7 @@ module OpenNebula
|
||||
# If a second parameter is present it is used as the error message when
|
||||
# the command fails
|
||||
def self.exec_and_log(command, message=nil, allowed_return_code=0)
|
||||
command = command.shellsplit.shelljoin # escape
|
||||
output=`#{command} 2>&1 1>/dev/null`
|
||||
code=$?.exitstatus
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user