diff --git a/src/mad/ruby/scripts_common.rb b/src/mad/ruby/scripts_common.rb index 4562b8e9c6..eb52c772bd 100644 --- a/src/mad/ruby/scripts_common.rb +++ b/src/mad/ruby/scripts_common.rb @@ -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