[autotest] Add a new RPC interface, get_host_attribute.

Retrieve a host's attribute from afe_host_attributes table.
When you need to get only attribute info of a host, this RPC call is
lighter than using get_hosts RPC call.

DEPLOY=apache
BUG=chromium:215160
TEST=AUTOTEST_ROOT$ python
>>import common
>>from autotest_lib.server.cros.dynamic_suite import tools, frontend_wrappers
>>afe = frontend_wrappers.RetryingAFE(timeout_min=5, delay_sec=10)
>>afe.get_host_attribute('need_crash_logs', hostname=<host ip>)

Change-Id: I86bc17091c078823c270206d80bd572f2fbbeb95
Reviewed-on: https://chromium-review.googlesource.com/221510
Reviewed-by: Fang Deng <fdeng@chromium.org>
Commit-Queue: Mungyung Ryu <mkryu@google.com>
Tested-by: Mungyung Ryu <mkryu@google.com>
diff --git a/server/frontend.py b/server/frontend.py
index 4fecc6c..06ea5d6 100644
--- a/server/frontend.py
+++ b/server/frontend.py
@@ -236,6 +236,11 @@
         return self.get_hosts(id=id)[0]
 
 
+    def get_host_attribute(self, attr, **dargs):
+        host_attrs = self.run('get_host_attribute', attribute=attr, **dargs)
+        return [HostAttribute(self, a) for a in host_attrs]
+
+
     def set_host_attribute(self, attr, val, **dargs):
         self.run('set_host_attribute', attribute=attr, value=val, **dargs)
 
@@ -935,6 +940,17 @@
         return 'TEST STATUS: %s' % self.id
 
 
+class HostAttribute(RpcObject):
+    """
+    AFE host attribute object
+
+    Fields:
+        id, host, attribute, value
+    """
+    def __repr__(self):
+        return 'HOST ATTRIBUTE %d' % self.id
+
+
 class MachineTestPairing(object):
     """
     Object representing the pairing of a machine label with a control file