buffet: Pretty print GetDeviceInfo and GetState
Modify the dbus calls for GetDeviceInfo and GetState to
return pretty printed JSON instead of the standard JSON output
(everything on one long line). I think the main users of this
function will be tools like buffet_client that will be displaying
it for human consumption.
TEST=FEATURES=test emerge-${BOARD} buffet
BUG=none
Change-Id: I208f188fa3a8ffe52bd2d3e50289f4e99b8c0dbc
Reviewed-on: https://chromium-review.googlesource.com/263497
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Nathan Bullock <nathanbullock@google.com>
Reviewed-by: Vitaly Buka <vitalybuka@chromium.org>
Commit-Queue: Nathan Bullock <nathanbullock@google.com>
diff --git a/buffet/buffet_client.cc b/buffet/buffet_client.cc
index 355d39b..e8ec78d 100644
--- a/buffet/buffet_client.cc
+++ b/buffet/buffet_client.cc
@@ -299,8 +299,7 @@
return ReportError(error.get());
}
- printf("Device Info: %s\n",
- device_info.empty() ? "<unregistered>" : device_info.c_str());
+ printf("%s\n", device_info.c_str());
OnJobComplete();
}
@@ -350,7 +349,7 @@
if (!manager_proxy->GetState(&json, &error)) {
return ReportError(error.get());
}
- printf("Device State: %s\n", json.c_str());
+ printf("%s\n", json.c_str());
OnJobComplete();
}