Closed fishikles closed 2 years ago
Hi @fishikles
I tested your job definition with the following results:
3.2.8:
4.0.1:
4.2.0:
Also tested with real commands.
Maybe I missed something in the job def?
Regards!
Hi @MegaDrive68k,
It needs to be run on a remote node not locally. See below:
I'm not sure why the job was run locally when you imported it, I have it setup to run remotely (I have no node filter set and am overriding it when triggering the job):
I've tested running it locally and it works as expected:
(In my setup lo1-uops-ecat-7 is the local host and upgrade@lo1-uops-ecat-7 is another account setup as a remote node.)
Thanks, Charles
Hi @MegaDrive68k ,
Have you been able to reproduce this issue? Any idea how we can resolve it, as it is holding up out migration to v4
Thanks, Charles
We are running into this as well. It looks like it may be similar to #7338 ... we cannot successfully quote or escape option arguments.
Rundeck 4.2.1 Remote execution argsquoted = true
What the output should be:
+ OPTION_A=test
+ OPTION_B='Acme Test Co.'
+ OPTION_C=e0547fc1-650e-b7fb-b542-152a103210ea
Execution preview: $ sudo "scriptfile ${option.a} ${option.b} ${option.c}"
+ OPTION_A=test
+ OPTION_B=Acme
/tmp/9-20286-software-dispatch-script.tmp.sh: line 7: $3: unbound variable
Execution preview: $ sudo "scriptfile '${option.a}' '${option.b}' '${option.c}'"
+ OPTION_A=test
+ OPTION_B=Acme
/tmp/10-20287-software-dispatch-script.tmp.sh: line 7: $3: unbound variable
Execution preview: $ sudo "scriptfile "${option.a}" "${option.b}" "${option.c}""
+ OPTION_A=test
+ OPTION_B=Acme
/tmp/11-20288-software-dispatch-script.tmp.sh: line 7: $3: unbound variable
Execution preview: $ sudo "scriptfile \"${option.a}\" \"${option.b}\" \"${option.c}\""
+ OPTION_A='"test"'
+ OPTION_B='"Acme'
+ OPTION_C=Test
Execution preview: $ sudo "scriptfile "\""${option.a}"\"" "\""${option.b}"\"" "\""${option.c}"\"""
+ OPTION_A='"test "acme'
+ OPTION_B=Test
+ OPTION_C='Co. "e0547fc1-650e-b7fb-b542-152a103210ea\'
Obviously the execution preview is not accurate, and there's some sort of sanitation happening.
Okay we got it to work with triple quotes:
Execution preview: $ sudo "scriptfile """${option.a}""" """${option.b}""" """${option.c}""""
+ OPTION_A=test
+ OPTION_B='Acme Test Co.'
+ OPTION_C=e0547fc1-650e-b7fb-b542-152a103210ea
This only seems necessary for options that contain spaces. But good grief.
Hi @MegaDrive68k ,
Have you been able to reproduce this issue? Any idea how we can resolve it, as it is holding up out migration to v4
Thanks, Charles
I tried on remote nodes too. Still working normally. Do you see the same behavior from a fresh 4.2.X test env?
Hi @MegaDrive68k,
I've run a quick test on 4.2.1 using docker and the stub executors/nodes (as I haven't had time to setup ssh yet)
I noticed that the quoting on the command output by the stub executor has changes between versions: (this was run on the local node and a stub node) V4.2.1:
V3.2.8
Looks like this is the root of the issue. in V3.2.8 the * and ajasent test is quoted in single quotes, in v4.2.1 it is not.
Node setup is:
If you really need me to setup ssh access from my docker images to a test node so I don't have to use the stubs I can but it will take some time.
Thanks, Charles
Hi @MegaDrive68k,
Have you had any luck investigating this issue?
Regards, Charles
I've figued the issue.
see #7187 To fix you need to add the following to your framework.properties file: rundeck.feature.quoting.backwardCompatible=true
Describe the bug
My Rundeck detail
To Reproduce
Expected behaviour