Skip to content

Commit

Permalink
cache_fetch: Fix MI tree format
Browse files Browse the repository at this point in the history
The MI "cache_fetch" command was building a poorly formatted MI tree
(viz below). We fix the command tree format in order to make the
resulting data easier to digest programatically.

Old MI tree format visualization:
    'NULL: "out_key: [out_value]"'

New MI tree format visualization:
    '"key": "out_key", "value": "out_value"'

Reported by Hamid Elaosta.
Fixes #1298
  • Loading branch information
liviuchircu committed Mar 1, 2018
1 parent ca34b0d commit 0f65dbf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mi/mi_core.c
Expand Up @@ -511,8 +511,10 @@ static struct mi_root *mi_cachefetch(struct mi_root *cmd, void *param)
goto done;
}

addf_mi_node_child( &rpl_tree->node, 0, 0, 0, "%.*s = [%.*s]", attr.len,
attr.s, value.len, value.s);
addf_mi_node_child(&rpl_tree->node, 0, "key", 3, "%.*s",
attr.len, attr.s);
addf_mi_node_child(&rpl_tree->node, 0, "value", 5, "%.*s",
value.len, value.s);

pkg_free(value.s);

Expand Down

0 comments on commit 0f65dbf

Please sign in to comment.