Fix run_script method.
Existing code assumes the script sent by the user is terminated with a newline. Appending magic string without '\n' before print() command results in a syntactically incorrect Groovy code. This patch ensures that '\n' is added between user's provided script and appended magic string. Change-Id: I39021f1058e7434d487efb4bc7aca18416b2c08e
This commit is contained in:
parent
e5e7a097b1
commit
4e64f0f880
@ -1299,8 +1299,8 @@ class Jenkins(object):
|
||||
Plugin:maven-plugin, Plugin:pam-auth]'
|
||||
'''
|
||||
magic_str = ')]}.'
|
||||
print_magic_str = 'println()\nprint("{}")'.format(magic_str)
|
||||
data = {'script': script.encode('utf-8') + print_magic_str.encode('utf-8')}
|
||||
print_magic_str = 'print("{}")'.format(magic_str)
|
||||
data = {'script': "{0}\n{1}".format(script, print_magic_str).encode('utf-8')}
|
||||
if node:
|
||||
url = self._build_url(NODE_SCRIPT_TEXT, locals())
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user