Initialize machine_id_checksum. Make unlocking unlocked machine a warning.
Fix issues causing errors in nightly tester: Attempting to use
machine_id_checksum when it hasn't been initialized; and attempting to
unlock an already unlocked machine causes a fatal error.
Change-Id: Ia149953d4e25c7abf97a189bb5fdd129de865c34
Reviewed-on: https://gerrit-int.chromium.org/42489
Reviewed-by: Yunlian Jiang <yunlian@google.com>
Commit-Queue: Caroline Tice <cmtice@google.com>
Tested-by: Caroline Tice <cmtice@google.com>
diff --git a/lock_machine.py b/lock_machine.py
index 0f948c3..1496a2c 100755
--- a/lock_machine.py
+++ b/lock_machine.py
@@ -207,8 +207,8 @@
def Unlock(self, exclusive, force=False):
with FileLock(self._lock_file) as lock:
if not lock.IsLocked():
- self._logger.LogError("Can't unlock unlocked machine!")
- return False
+ self._logger.LogWarning("Can't unlock unlocked machine!")
+ return True
if lock.exclusive != exclusive:
self._logger.LogError("shared locks must be unlocked with --shared")