[master] 69dc99d33 fix cli backend.list -p / backend.list -p -j
Nils Goroll
nils.goroll at uplex.de
Tue Feb 5 10:04:10 UTC 2019
commit 69dc99d33b8073e55c1ed4f26caa1b8fd249499e
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Tue Feb 5 11:01:33 2019 +0100
fix cli backend.list -p / backend.list -p -j
$ /tmp/bin/varnishadm backend.list -p
Backend name Admin Probe Last change
boot.a1 probe healthy Tue, 05 Feb 2019 09:58:23 GMT
$ /tmp/bin/varnishadm backend.list -pj
[ 2, ["backend.list", "-pj"], 1549360935.584,
{
"boot.a1": {
"type": "backend",
"admin_health": "probe",
"probe_message": "healthy",
"probe_details": {},
"last_change": 1549360703.515
},
Fixes #2894
diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c
index 2c8ce70f8..039871fc0 100644
--- a/bin/varnishd/cache/cache_backend.c
+++ b/bin/varnishd/cache/cache_backend.c
@@ -458,8 +458,12 @@ vbe_list(VRT_CTX, const struct director *d, struct vsb *vsb, int vflag,
if (bp->probe != NULL)
VBP_Status(vsb, bp, vflag | pflag, jflag);
- else if ((vflag | pflag) == 0 && jflag)
+ else if (jflag && (vflag | pflag))
+ VSB_printf(vsb, "{},\n");
+ else if (jflag)
VSB_printf(vsb, "\"%s\"", d->sick ? "sick" : "healthy");
+ else if (vflag | pflag)
+ return;
else
VSB_printf(vsb, "%-10s", d->sick ? "sick" : "healthy");
}
More information about the varnish-commit
mailing list