Quote message when reporting to Gerrit

If the message has double quotation marks, Gerrit will not be able
to parse it.  This applies shell quotes to the message before
sending it.

Change-Id: Ieda76b0f64346ab1388affead1a17630af61a5e6
This commit is contained in:
James E. Blair 2017-05-19 09:32:19 -07:00
parent 14b315d556
commit fc220282e2
1 changed files with 2 additions and 1 deletions

View File

@ -20,6 +20,7 @@ import threading
import time
from six.moves import queue as Queue
from six.moves import urllib
from six.moves import shlex_quote
import paramiko
import logging
import pprint
@ -614,7 +615,7 @@ class GerritConnection(BaseConnection):
def review(self, project, change, message, action={}):
cmd = 'gerrit review --project %s' % project
if message:
cmd += ' --message "%s"' % message
cmd += ' --message %s' % shlex_quote(message)
for key, val in action.items():
if val is True:
cmd += ' --%s' % key