Skip to content

small changes to how lvalert_listen parses commands out of INI file

Reed Essick requested to merge reed.essick/lvalert:master into master

Note, this is a "copy" of !7 (closed) with a cleaned up log. (I wasn't sure how to do that, so I simply nuked my branch and started from scratch).

Modified how commands are read out of config file when passed to subprocess.Popen and/or multiprocessing.Process. This should be entirely backward compatible, but will now allow users to specify command line options and arguments directly within the INI file rather than having to use a wrapper script. The caveat here is there cannot be an spaces within a single option. For example, 'script --option option1' is fine but 'script --option "option 1"' is not.

I tested this on under /home/reed.essick/lvalert-dev/lvalert/test/ after installing lvalert under /home/reed.essick/lvalert-dev/dev-grinch/opt and setting up my paths as necessary. Under ~test/, I created a simple executable (to be forked by lvalert_listen) and two config files, one with arguments and one without. Using the idq-test node (which the idq username owns), I then ran the listener once with each config file and sent each instance a simple json packet (~test/tmp.json) via lvalert_send. I've included the output below

$ lvalert_listen --config lvalert_withOptions.ini

recieved 3 arguments : option1 option2 option3

{"example": "alert"}

$ lvalert_listen --config lvalert_withoutOptions.ini

no arguments received

{"example": "alert"}

Merge request reports