Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
128fd400
Commit
128fd400
authored
Sep 25, 2018
by
Geoff Simmons
Committed by
Dridi Boukelmoune
Oct 16, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add JSON support for the "panic.show" CLI command.
The panic string is added as a JSON string in the output array.
parent
95e9cfe6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
7 deletions
+31
-7
mgt_child.c
bin/varnishd/mgt/mgt_child.c
+27
-7
c00057.vtc
bin/varnishtest/tests/c00057.vtc
+2
-0
v00010.vtc
bin/varnishtest/tests/v00010.vtc
+2
-0
No files found.
bin/varnishd/mgt/mgt_child.c
View file @
128fd400
...
...
@@ -117,12 +117,9 @@ mgt_panic_clear(void)
VSB_destroy
(
&
child_panic
);
}
static
void
v_matchproto_
(
cli_func_t
)
mch_cli_panic_show
(
struct
cli
*
cli
,
const
char
*
const
*
av
,
void
*
priv
)
static
void
cli_panic_show
(
struct
cli
*
cli
,
const
char
*
const
*
av
,
int
json
)
{
(
void
)
av
;
(
void
)
priv
;
if
(
!
child_panic
)
{
VCLI_SetResult
(
cli
,
CLIS_CANT
);
VCLI_Out
(
cli
,
...
...
@@ -130,7 +127,29 @@ mch_cli_panic_show(struct cli *cli, const char * const *av, void *priv)
return
;
}
VCLI_Out
(
cli
,
"%s
\n
"
,
VSB_data
(
child_panic
));
if
(
!
json
)
{
VCLI_Out
(
cli
,
"%s
\n
"
,
VSB_data
(
child_panic
));
return
;
}
VCLI_JSON_begin
(
cli
,
2
,
av
);
VCLI_Out
(
cli
,
",
\n
"
);
VCLI_JSON_str
(
cli
,
VSB_data
(
child_panic
));
VCLI_JSON_end
(
cli
);
}
static
void
v_matchproto_
(
cli_func_t
)
mch_cli_panic_show
(
struct
cli
*
cli
,
const
char
*
const
*
av
,
void
*
priv
)
{
(
void
)
priv
;
cli_panic_show
(
cli
,
av
,
0
);
}
static
void
v_matchproto_
(
cli_func_t
)
mch_cli_panic_show_json
(
struct
cli
*
cli
,
const
char
*
const
*
av
,
void
*
priv
)
{
(
void
)
priv
;
cli_panic_show
(
cli
,
av
,
1
);
}
static
void
v_matchproto_
(
cli_func_t
)
...
...
@@ -694,7 +713,8 @@ static struct cli_proto cli_mch[] = {
mch_cli_server_status_json
},
{
CLICMD_SERVER_START
,
""
,
mch_cli_server_start
},
{
CLICMD_SERVER_STOP
,
""
,
mch_cli_server_stop
},
{
CLICMD_PANIC_SHOW
,
""
,
mch_cli_panic_show
},
{
CLICMD_PANIC_SHOW
,
""
,
mch_cli_panic_show
,
mch_cli_panic_show_json
},
{
CLICMD_PANIC_CLEAR
,
""
,
mch_cli_panic_clear
},
{
NULL
}
};
...
...
bin/varnishtest/tests/c00057.vtc
View file @
128fd400
...
...
@@ -44,6 +44,7 @@ client c1 {
} -run
varnish v1 -cliexpect "STACK OVERFLOW" "panic.show"
varnish v1 -clijson "panic.show -j"
varnish v1 -cliok "panic.clear"
...
...
@@ -81,6 +82,7 @@ client c2 -connect ${v2_sock} {
} -run
varnish v2 -cliexpect "[bB]us error|Segmentation [fF]ault" "panic.show"
varnish v2 -clijson "panic.show -j"
varnish v2 -cliok "panic.clear"
...
...
bin/varnishtest/tests/v00010.vtc
View file @
128fd400
...
...
@@ -54,6 +54,7 @@ client c1 {
varnish v1 -wait-stopped
varnish v1 -cliok "panic.show"
varnish v1 -clijson "panic.show -j"
varnish v1 -cliok "panic.clear"
varnish v1 -expect MGT.child_panic == 1
varnish v1 -clierr 300 "panic.clear"
...
...
@@ -70,6 +71,7 @@ client c1 {
varnish v1 -wait-stopped
varnish v1 -cliok "panic.show"
varnish v1 -clijson "panic.show -j"
varnish v1 -cliok "panic.clear -z"
varnish v1 -expect MGT.child_panic == 0
varnish v1 -clierr 300 "panic.clear"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment