cros_flash: add clear-tpm-owner to flash options

This would help developers had the ability to clobber-stateful and
clear-tpm-owner in the same time.

BUG=b:154183750
TEST=cros flash --clobber-stateful --clear-tpm-owner $DUT ${BOARD}/latest

Change-Id: I2fc8659144980ee212515f4e8cbd55bc8e7594a2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2491624
Tested-by: joe Chou <yich@google.com>
Commit-Queue: joe Chou <yich@google.com>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
diff --git a/cli/flash.py b/cli/flash.py
index ca8a819..bfcf0ee 100644
--- a/cli/flash.py
+++ b/cli/flash.py
@@ -364,7 +364,7 @@
                board=None, src_image_to_delta=None, wipe=True, debug=False,
                yes=False, force=False, ssh_private_key=None, ping=True,
                disable_verification=False, send_payload_in_parallel=False,
-               version=None):
+               clear_tpm_owner=False, version=None):
     """Initializes RemoteDeviceUpdater"""
     if not stateful_update and not rootfs_update:
       raise ValueError('No update operation to perform; either stateful or'
@@ -379,6 +379,7 @@
     self.do_rootfs_update = rootfs_update
     self.disable_verification = disable_verification
     self.clobber_stateful = clobber_stateful
+    self.clear_tpm_owner = clear_tpm_owner
     self.reboot = reboot
     self.debug = debug
     self.ssh_private_key = ssh_private_key
@@ -523,6 +524,7 @@
               reboot=self.reboot,
               disable_verification=self.disable_verification,
               clobber_stateful=self.clobber_stateful,
+              clear_tpm_owner=self.clear_tpm_owner,
               yes=self.yes,
               send_payload_in_parallel=self.send_payload_in_parallel,
               resolve_app_id_mismatch=True,
@@ -552,7 +554,7 @@
           reboot=True, wipe=True, ssh_private_key=None, ping=True,
           disable_rootfs_verification=False, clear_cache=False, yes=False,
           force=False, debug=False, send_payload_in_parallel=False,
-          version=None):
+          clear_tpm_owner=False, version=None):
   """Flashes a device, USB drive, or file with an image.
 
   This provides functionality common to `cros flash` and `brillo flash`
@@ -570,6 +572,7 @@
     rootfs_update: Update rootfs partition; SSH |device| scheme only.
     stateful_update: Update stateful partition; SSH |device| scheme only.
     clobber_stateful: Clobber stateful partition; SSH |device| scheme only.
+    clear_tpm_owner: Clear the TPM owner on reboot; SSH |device| scheme only.
     reboot: Reboot device after update; SSH |device| scheme only.
     wipe: Wipe temporary working directory; SSH |device| scheme only.
     ssh_private_key: Path to an SSH private key file; None to use test keys.
@@ -619,6 +622,7 @@
         rootfs_update=rootfs_update,
         stateful_update=stateful_update,
         clobber_stateful=clobber_stateful,
+        clear_tpm_owner=clear_tpm_owner,
         reboot=reboot,
         wipe=wipe,
         debug=debug,