JUANM
November 23, 2019, 2:27am
#1
Problem:
Hello,
I want to ask how to filter input on foreman remote execution, example:
ping -c3 8.8.8.8; ls / ; who
How to make template for filter symbol like “;” or “@”,"/","|",etc. Because i just need run one command on one input. Thanks before.
Regards.
There’s no good way AFAICT. We could probably add some macro, that would wrap the input in Shellwords.escape
. Then in template, you’d do something like <%= escape_shell(input('aksi')) %>
. Would you be interested in opening a PR? Macro should be probably added to https://github.com/theforeman/foreman/blob/develop/lib/foreman/renderer/scope/macros/base.rb#L150
1 Like
JUANM
February 6, 2020, 12:22pm
#4
Sorry for the late reply. I have done my problem, i use this regex to my input and i have solve my problem for filter symbol like “;” or “@”,"/","|",etc.
.match(/(^[^\s;|&]+)/)
Thanks a lot for your help guys