mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-21 19:02:25 +00:00
cpu-gather: Transport data as json
More reliable, easier to parse, easier to edit. Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
12f01dcb04
commit
2933047c02
@ -193,9 +193,12 @@ def gather(args):
|
||||
|
||||
|
||||
def parse(args):
|
||||
data = json.load(sys.stdin)
|
||||
|
||||
os.environ["CPU_GATHER_PY"] = "true"
|
||||
output = subprocess.check_output(
|
||||
"./cpu-parse.sh",
|
||||
input=output_to_text(data),
|
||||
stderr=subprocess.STDOUT,
|
||||
universal_newlines=True)
|
||||
print(output)
|
||||
@ -267,7 +270,7 @@ def main():
|
||||
|
||||
if args.gather:
|
||||
data = gather(args)
|
||||
print(output_to_text(data))
|
||||
json.dump(data, sys.stdout, indent=2)
|
||||
else:
|
||||
parse(args)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user