hwid: Revises the format of probed results from yaml to json.
This CL deprecates the legacy yaml-formatted probed results for the
HWID framework by the json-formatted one, which matches the output
of the new probe framework.
BUG=chromium:689944
TEST=make test
Change-Id: If534674694c58dcfa59d1040359718569586dfa7
Reviewed-on: https://chromium-review.googlesource.com/842762
Commit-Ready: Yong Hong <yhong@google.com>
Tested-by: Yong Hong <yhong@google.com>
Reviewed-by: Cheng-Han Yang <chenghan@chromium.org>
diff --git a/py/gooftool/commands.py b/py/gooftool/commands.py
index 71d2aff..ab0f496 100755
--- a/py/gooftool/commands.py
+++ b/py/gooftool/commands.py
@@ -22,8 +22,6 @@
import time
import xmlrpclib
-import yaml
-
import factory_common # pylint: disable=unused-import
from cros.factory.gooftool.common import ExecFactoryPar
from cros.factory.gooftool.common import Shell
@@ -43,6 +41,7 @@
from cros.factory.utils.argparse_utils import verbosity_cmd_arg
from cros.factory.utils.debug_utils import SetupLogging
from cros.factory.utils import file_utils
+from cros.factory.utils import json_utils
from cros.factory.utils import sys_utils
from cros.factory.utils import time_utils
from cros.factory.utils.process_utils import Spawn
@@ -222,9 +221,11 @@
CmdArg('--no_vol', action='store_true',
help='Do not probe volatile data.'))
def RunProbe(options):
- """Print yaml-formatted breakdown of probed device properties."""
+ """Print json-formatted breakdown of probed device properties."""
+ logging.warning('This sub-command is going to be deprecated by `probe` '
+ 'command-line tool, please see `probe --help` for detail.')
probed_result = GetGooftool(options).Probe(options.comps, not options.no_vol)
- print yaml.dump(probed_result)
+ print json_utils.DumpStr(probed_result, pretty=True)
@Command('verify_components')
@@ -748,7 +749,7 @@
db = GetGooftool(options).db
encoded_string = options.hwid or hwid_utils.GetHWIDString()
if options.probe_results:
- probed_results = yaml.load(file_utils.ReadFile(options.probe_results))
+ probed_results = hwid_utils.GetProbedResults(infile=options.probe_results)
else:
probed_results = GetGooftool(options).Probe()