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
95e9cfe6
Commit
95e9cfe6
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 "storage.list" CLI command.
parent
2776c9c7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
1 deletion
+28
-1
mgt_stevedore.c
bin/varnishd/storage/mgt_stevedore.c
+27
-1
b00032.vtc
bin/varnishtest/tests/b00032.vtc
+1
-0
No files found.
bin/varnishd/storage/mgt_stevedore.c
View file @
95e9cfe6
...
...
@@ -82,10 +82,36 @@ stv_cli_list(struct cli *cli, const char * const *av, void *priv)
VCLI_Out
(
cli
,
"
\t
storage.%s = %s
\n
"
,
stv
->
ident
,
stv
->
name
);
}
static
void
v_matchproto_
(
cli_func_t
)
stv_cli_list_json
(
struct
cli
*
cli
,
const
char
*
const
*
av
,
void
*
priv
)
{
struct
stevedore
*
stv
;
int
n
=
0
;
(
void
)
priv
;
ASSERT_MGT
();
VCLI_JSON_begin
(
cli
,
2
,
av
);
VCLI_Out
(
cli
,
",
\n
"
);
STV_Foreach
(
stv
)
{
VCLI_Out
(
cli
,
"%s"
,
n
?
",
\n
"
:
""
);
n
++
;
VCLI_Out
(
cli
,
"{
\n
"
);
VSB_indent
(
cli
->
sb
,
2
);
VCLI_Out
(
cli
,
"
\"
name
\"
: "
);
VCLI_JSON_str
(
cli
,
stv
->
ident
);
VCLI_Out
(
cli
,
",
\n
"
);
VCLI_Out
(
cli
,
"
\"
storage
\"
: "
);
VCLI_JSON_str
(
cli
,
stv
->
name
);
VSB_indent
(
cli
->
sb
,
-
2
);
VCLI_Out
(
cli
,
"
\n
}"
);
}
VCLI_JSON_end
(
cli
);
}
/*--------------------------------------------------------------------*/
static
struct
cli_proto
cli_stv
[]
=
{
{
CLICMD_STORAGE_LIST
,
""
,
stv_cli_list
},
{
CLICMD_STORAGE_LIST
,
""
,
stv_cli_list
,
stv_cli_list_json
},
{
NULL
}
};
...
...
bin/varnishtest/tests/b00032.vtc
View file @
95e9cfe6
varnishtest "CLI coverage test"
varnish v1 -cliok storage.list
varnish v1 -clijson "storage.list -j"
server s1 {
rxreq
...
...
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