Merge pull request #10328 from ton31337/fix/vty_json

This commit is contained in:
Igor Ryzhov 2022-01-13 09:45:57 +03:00 committed by GitHub
commit 379effbf70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 27 deletions

View File

@ -672,10 +672,7 @@ static int bgp_print_dampening_parameters(struct bgp *bgp, struct vty *vty,
json_object_int_add(json, "maxSuppressPenalty", json_object_int_add(json, "maxSuppressPenalty",
bdc->ceiling); bdc->ceiling);
vty_out(vty, "%s\n", vty_json(vty, json);
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else { } else {
vty_out(vty, "Half-life time: %lld min\n", vty_out(vty, "Half-life time: %lld min\n",
(long long)bdc->half_life / 60); (long long)bdc->half_life / 60);

View File

@ -10350,12 +10350,8 @@ DEFPY (show_ip_ospf_gr_helper,
vty, ospf, use_vrf, json, uj, detail); vty, ospf, use_vrf, json, uj, detail);
} }
if (uj) { if (uj)
vty_out(vty, "%s\n", vty_json(vty, json);
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
}
return ret; return ret;
} }
@ -10364,12 +10360,9 @@ DEFPY (show_ip_ospf_gr_helper,
if (ospf == NULL || !ospf->oi_running) { if (ospf == NULL || !ospf->oi_running) {
if (uj) { if (uj)
vty_out(vty, "%s\n", vty_json(vty, json);
json_object_to_json_string_ext( else
json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else
vty_out(vty, "%% OSPF instance not found\n"); vty_out(vty, "%% OSPF instance not found\n");
return CMD_SUCCESS; return CMD_SUCCESS;
@ -10381,12 +10374,9 @@ DEFPY (show_ip_ospf_gr_helper,
if (ospf == NULL || !ospf->oi_running) { if (ospf == NULL || !ospf->oi_running) {
if (uj) { if (uj)
vty_out(vty, "%s\n", vty_json(vty, json);
json_object_to_json_string_ext( else
json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
} else
vty_out(vty, "%% OSPF instance not found\n"); vty_out(vty, "%% OSPF instance not found\n");
return CMD_SUCCESS; return CMD_SUCCESS;
@ -10396,11 +10386,8 @@ DEFPY (show_ip_ospf_gr_helper,
detail); detail);
} }
if (uj) { if (uj)
vty_out(vty, "%s\n", json_object_to_json_string_ext( vty_json(vty, json);
json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
}
return CMD_SUCCESS; return CMD_SUCCESS;
} }