varnish-cache icon indicating copy to clipboard operation
varnish-cache copied to clipboard

Varnishadm: Add -e argument

Open walid-git opened this issue 2 years ago • 6 comments

-e Exit immediately if a command fails in pass mode and return the CLI status code of the failing command. This has no effect on interactive mode (except when -p is used). Similarly to CLI Command File (see :ref:varnishd(1)), if a command is prefixed with '-', its failure will be ignored and will not cause varnishadm to exit.

Fixes: #4012

walid-git avatar Nov 08 '23 10:11 walid-git

Bugwash:

[15:09:38] <phk> I dont see any problems [15:09:49] <phk> but I guess we should give @nigoroll a chance

walid-git avatar Nov 08 '23 14:11 walid-git

I am not sure if what I am asking for justifies the effort, but I am having a hard time following the first commit. If it is not too much work, could it be split into smaller commits or could the commit message explain better what it does?

nigoroll avatar Nov 13 '23 14:11 nigoroll

If it is not too much work, could it be split into smaller commits or could the commit message explain better what it does?

Not sure how the github web UI would render it, but if the discarded comment was preserved as I suggested we would likely have a cleaner diff.

dridi avatar Nov 13 '23 14:11 dridi

I brought back the comment mentioned by Dridi, hopefully this will make the diff a bit more readable. Otherwise, I don't see any way to break the commit into smaller ones.

walid-git avatar Nov 13 '23 16:11 walid-git

  • Changed the return value of varnishadm -e to cli status / 100 after phk's suggestion during bugwash. That is because CLI status can go beyond 255 and we might have a status code that is N*256 that will return 0.
  • Added polling to the remote cli socket so that we are notified if the socket hangs up when we are not writing anything.
  • Added quoting to the CLI command arguments so that the VCLS server we are forwarding commands to sees the arguments grouped in the same way they were received.

Note that tests will not pass until the bugfix in f354ca99f133fb501d01849ca8a111981c15fb84 is merged.

walid-git avatar Nov 16 '23 09:11 walid-git

Addressed dridi's comments:

  • Harmonized the exit status and documented them in EXIT STATUS section of the man page.
  • We don't forward the parsed heredoc now, we reconstruct it and forward it to be parsed in mgt instead.

Ready for review

walid-git avatar Dec 28 '23 09:12 walid-git