gooftool: use ExecFactoryPar to execute wipe_in_place, wipe_init

1. Use ExecFactoryPar to execute wipe_in_place and wipe_init
2. Expand arguments for wipe_init, stop using argument file
3. Use util function to find primary storage device and release rootfs,
   etc...

TEST=make test, manual test
BUG=None

Change-Id: I794df97ff07ab958374aacd66bf2d8145cdfb703
Reviewed-on: https://chromium-review.googlesource.com/340425
Commit-Ready: Wei-Han Chen <stimim@chromium.org>
Tested-by: Wei-Han Chen <stimim@chromium.org>
Reviewed-by: Shun-Hsing Ou <shunhsingou@chromium.org>
diff --git a/py/gooftool/commands.py b/py/gooftool/commands.py
index afd1ae2..a51e870 100755
--- a/py/gooftool/commands.py
+++ b/py/gooftool/commands.py
@@ -31,6 +31,7 @@
 from cros.factory.gooftool import crosfw
 from cros.factory.gooftool import report_upload
 from cros.factory.gooftool.core import Gooftool
+from cros.factory.gooftool.common import ExecFactoryPar
 from cros.factory.gooftool.common import Shell
 from cros.factory.gooftool.probe import Probe, PROBEABLE_COMPONENT_CLASSES
 from cros.factory.gooftool.probe import ReadRoVpd, ReadRwVpd
@@ -705,9 +706,21 @@
                                    options.shopfloor_url)
 
 @Command('wipe_init',
-         CmdArg('--wipe_file', help='path to the wipe args file'))
+         CmdArg('--wipe_args', help='arguments for clobber-state'),
+         CmdArg('--state_dev', help='path to stateful partition device'),
+         CmdArg('--root_disk', help='path to primary device'),
+         CmdArg('--old_root', help='path to old root'),
+         _cutoff_args_cmd_arg,
+         _shopfloor_url_args_cmd_arg,
+         _release_rootfs_cmd_arg)
 def WipeInit(options):
-  GetGooftool(options).WipeInit(options.args_file)
+  GetGooftool(options).WipeInit(options.wipe_args,
+                                options.cutoff_args,
+                                options.shopfloor_url,
+                                options.state_dev,
+                                options.release_rootfs,
+                                options.root_disk,
+                                options.old_root)
 
 @Command('prepare_wipe',
          CmdArg('--fast', action='store_true',
@@ -950,7 +963,13 @@
   UploadReport(options)
   if options.wipe_in_place:
     event_log.Log('wipe_in_place')
-    WipeInPlace(options)
+    # WipeInPlace(options)
+    wipe_args = []
+    wipe_args += ['--cutoff_args', options.cutoff_args]
+    wipe_args += ['--shopfloor_url', options.shopfloor_url]
+    if options.fast:
+      wipe_args += ['--fast']
+    ExecFactoryPar('gooftool', 'wipe_in_place', *wipe_args)
   else:
     PrepareWipe(options)