[autotest] Change deployment_test to lock hosts if needed.

The `deployment_test` script requires a locked host.  Previously, it
would fail with an error if the host weren't locked.  This changes
the script to lock the host if it isn't locked.

Regardless of locking state prior to the script start, on success, a
host will be unlocked.  If a host fails, the host will be unlocked
only if the script locked the host at the outset.

BUG=None
TEST=Run against a DUT in the lab.

Change-Id: I9a0953e150f8fa65e3e90e9d9f204a73177759e4
Reviewed-on: https://chromium-review.googlesource.com/298174
Commit-Ready: Richard Barnette <jrbarnette@chromium.org>
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Dan Shi <dshi@chromium.org>
1 file changed