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)

(cherry picked from commit 04b83c9a114af7decf41e5f4d543d13705f9009c)
This commit is contained in:
Vlastimil Holer 2021-03-30 17:15:40 +02:00 committed by Ruben S. Montero
parent efa6478bbf
commit 2ab0fa2943
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87

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