1
0
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)

This commit is contained in:
Vlastimil Holer 2021-03-30 17:15:40 +02:00 committed by GitHub
parent b3dbc7c5e3
commit 04b83c9a11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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