Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
detect Varnish instances and try to be helpful
One Karnaugh map later and I realized that #116 (comment) could have been expressed more simply. If `varnishadm ping` is successful with the current NAME argument, no question asked, go for it: ``` Info: Working directory: /tmp/varnishgather.Z1LTcYva/varnishgather-flamp-20241106-214646 Info: Complete varnishadm command line deduced to: Task: 1: varnishd -V ... ``` If pinging failed, there are a few cases: If NAME was given, or if NAME wasn't given but there's no varnishd detected, issue a warning, pause a bit, then proceed: ``` Info: Working directory: /tmp/varnishgather.BBE414gf/varnishgather-flamp-20241106-221201 using: varnishadm ping, We couldn't ping varnishd, Is it running and is ./varnishgather running with the right permissions? Info: Complete varnishadm command line deduced to: <PAUSE 10s> Task: 1: varnishd -V ... ``` if no NAME was given but there's exactly one candidate, and it's pingable, override NAME, warn about it, pause then proceed: ``` Info: Working directory: /tmp/varnishgather.ZeUDcfg7/varnishgather-flamp-20241106-222151 using: varnishadm ping, We couldn't ping varnishd, Is it running and is ./varnishgather running with the right permissions? There's only one varnishd running and it's pingable. Overriding -n argument to /tmp/beepboop <PAUSE 10s> Info: Complete varnishadm command line deduced to: -n /tmp/beepboop Task: 1: varnishd -V ... ``` If no NAME is given, and there's only one candidate but it's not pingable, just error out: ``` Info: Working directory: /tmp/varnishgather.eZSa78VU/varnishgather-flamp-20241106-224856 using: varnishadm ping, We couldn't ping varnishd, Is it running and is ./varnishgather running with the right permissions? <EXIT> ``` Finally, if there are no given NAME, and we have more than one candidate, we just propose a list of candidates and error out: ``` Info: Working directory: /tmp/varnishgather.dkGgfqHe/varnishgather-flamp-20241106-223210 using: varnishadm ping, We couldn't ping varnishd, Is it running and is ./varnishgather running with the right permissions? We've also detected one or more varnishd that could possibly be pinged with these -n arguments: -n /tmp/beepboop -n /tmp/beepboop2 <EXIT> ```
- Loading branch information