[autotest] Require lock reason to lock device
When locking a device, a locking reason now must be provided.
This applies to both adding a new device, and modifying an
existing device from both the web frontend and the atest
command-line tool.
BUG=chromium:336805
DEPLOY=migrate
TEST=Tested adding locked/unlocked devices and locking/unlocking devices
from both the web frontend and using the 'atest host ...' command-line tools.
Change-Id: I3a8cd8891a2999f026dd709ae8a79e2b8cbc251a
Reviewed-on: https://chromium-review.googlesource.com/267595
Tested-by: Matthew Sartori <msartori@chromium.org>
Reviewed-by: Dan Shi <dshi@chromium.org>
Commit-Queue: Matthew Sartori <msartori@chromium.org>
diff --git a/frontend/afe/models.py b/frontend/afe/models.py
index 27ae9da..b0c7ad5 100644
--- a/frontend/afe/models.py
+++ b/frontend/afe/models.py
@@ -572,7 +572,7 @@
}
if other_metadata:
metadata = dict(metadata.items() + other_metadata.items())
- autotest_es.post(type_str=type_str, metadata=metadata)
+ autotest_es.post(use_http=True, type_str=type_str, metadata=metadata)
def save(self, *args, **kwargs):
@@ -589,7 +589,8 @@
self.locked_by = User.current_user()
self.lock_time = datetime.now()
self.record_state('lock_history', 'locked', self.locked,
- {'changed_by': self.locked_by.login})
+ {'changed_by': self.locked_by.login,
+ 'lock_reason': self.lock_reason})
self.dirty = True
elif not self.locked and self.locked_by:
self.record_state('lock_history', 'locked', self.locked,