[autotest] Bug fix for modify_hosts RPC.
'update_data' is an argument of 'modify_hosts', and it is updated within
'modify_hosts'. That means the original variable passed as 'update_data'
is updated, and it seems to cause an error.
To be safe, it's better to make a copy for 'update_data' and updates the
copied one.
BUG=chromium:535651
TEST=Try lock/unlock multiple hosts.
Change-Id: I65e62158df55ff0b9d6d942e1ba9ab11730413dc
Reviewed-on: https://chromium-review.googlesource.com/319189
Reviewed-by: Dan Shi <dshi@chromium.org>
Tested-by: Mungyung Ryu <mkryu@google.com>
diff --git a/frontend/afe/rpc_interface.py b/frontend/afe/rpc_interface.py
index 50623db..107562d 100644
--- a/frontend/afe/rpc_interface.py
+++ b/frontend/afe/rpc_interface.py
@@ -330,6 +330,7 @@
@param host_filter_data: Filters out which hosts to modify.
@param update_data: A dictionary with the changes to make to the hosts.
"""
+ update_data = update_data.copy()
rpc_utils.check_modify_host(update_data)
hosts = models.Host.query_objects(host_filter_data)