cmd= ["sudo", "cat", "{filepath}".format(filepath=filepath), "|","egrep", "-v","\'{filteruser}\'".format(filteruser=filteruser)]
fileformat and filteruser may also be empty
configuration file below
[plugin_haproxy]
user= tara
host=localhost
filepath=/etc/haproxy/haproxy.global.inc
filter=
This is the command I want to run under the subprocess , checking the above variable values with pdb , displaying the next value and looking great
['sudo', 'cat', '/etc/haproxy/haproxy.global.inc', '|', 'egrep', '-v', "''"]
Manullay runs sudo cat / etc / haproxy / haproxy.global.inc code | egrep -v "''" on the terminal works fine
Why the subprocess is not able to process it.
"cat: |: There is no such file or directory \ ncat: egrep: There is no such file or Directory \ NCAT:
source
share