I am getting the following error when running the script below,can anyhelp to identify what the problem is and how to overcome it
import subprocess
import sy
First you need to add the quotes around 29418
as mgilson mentioned. Second let's break down what you're trying to run:
ssh_command = ["ssh", "-p", 29418, "review-android.company.com", "gerrit",
"query", "--format", "JSON", "--current-patch-set",
"--commit-message", "--files", ]
That equals
ssh -p 29418 review-android.company.com gerrit query --format JSON --current-patch-set --commit-message --files
(then I'm assuming you have filenames in your caf_gerrits.txt file which get appended at the end)
One thing that pops out at me is that you may want to say --format=JSON
in which case your elements in the ssh_command
array should be combined as [..., "--format=JSON", ...]
. The other thing you may want to do is print result
after your result=
line to help with the debugging.
The third element in ssh_command
is an integer. It needs to be a string.
e.g:
ssh_command = ["ssh", "-p", 29418, ...
# ^ problem
And the solution is simple, just add some quotes:
ssh_command = ["ssh", "-p", "29418", ...
# ^Now it's a string.