Foreman remote_execution template

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.

gambar

how to filter “;” guys?

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

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