Revert "Moblab: Servo Support via Host Attributes."
This reverts commit 71f190bc31be36311c1c59d762a13a28754d7ea9.
Reverting as the db migration does not work on systems that have not touched the afe at all.
Change-Id: I0c6875ec17f9362b7e646471b6ae5d06c70b770d
Reviewed-on: https://chromium-review.googlesource.com/255350
Reviewed-by: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
diff --git a/cli/host.py b/cli/host.py
index 53d572d..be1f318 100644
--- a/cli/host.py
+++ b/cli/host.py
@@ -20,7 +20,6 @@
See topic_common.py for a High Level Design and Algorithm.
"""
-import re
from autotest_lib.cli import action_common, topic_common
from autotest_lib.client.common_lib import host_protections
@@ -230,12 +229,12 @@
acls = self.execute_rpc('get_acl_groups', hosts__hostname=host)
labels = self.execute_rpc('get_labels', host__hostname=host)
- results.append([[stat], acls, labels, stat['attributes']])
+ results.append ([[stat], acls, labels])
return results
def output(self, results):
- for stats, acls, labels, attributes in results:
+ for stats, acls, labels in results:
print '-'*5
self.print_fields(stats,
keys=['hostname', 'platform',
@@ -244,7 +243,6 @@
self.print_by_ids(acls, 'ACLs', line_before=True)
labels = self._cleanup_labels(labels)
self.print_by_ids(labels, 'Labels', line_before=True)
- self.print_dict(attributes, 'Host Attributes', line_before=True)
class host_jobs(host):
@@ -310,14 +308,11 @@
"""atest host mod --lock|--unlock|--protection
--mlist <file>|<hosts>"""
usage_action = 'mod'
- attribute_regex = r'^(?P<attribute>\w+)=(?P<value>.+)?'
def __init__(self):
"""Add the options specific to the mod action"""
self.data = {}
self.messages = []
- self.attribute = None
- self.value = None
super(host_mod, self).__init__()
self.parser.add_option('-l', '--lock',
help='Lock hosts',
@@ -331,10 +326,6 @@
', '.join('"%s"' % p
for p in self.protections)),
choices=self.protections)
- self.parser.add_option('--attribute', '-a', default='',
- help=('Host attribute to add or change. Format '
- 'is <attribute>=<value>. Value can be '
- 'blank to delete attribute.'))
def parse(self):
@@ -347,18 +338,8 @@
self.data['protection'] = options.protection
self.messages.append('Protection set to "%s"' % options.protection)
- if len(self.data) == 0 and not options.attribute:
+ if len(self.data) == 0:
self.invalid_syntax('No modification requested')
-
- if options.attribute:
- match = re.match(self.attribute_regex, options.attribute)
- if not match:
- self.invalid_syntax('Attributes must be in <attribute>=<value>'
- ' syntax!')
-
- self.attribute = match.group('attribute')
- self.value = match.group('value')
-
return (options, leftover)
@@ -368,10 +349,6 @@
try:
res = self.execute_rpc('modify_host', item=host,
id=host, **self.data)
- if self.attribute:
- self.execute_rpc('set_host_attribute',
- attribute=self.attribute,
- value=self.value, hostname=host)
# TODO: Make the AFE return True or False,
# especially for lock
successes.append(host)
diff --git a/cli/host_unittest.py b/cli/host_unittest.py
index a9bdd90..33a2103 100755
--- a/cli/host_unittest.py
+++ b/cli/host_unittest.py
@@ -622,8 +622,7 @@
u'synch_id': None,
u'shard': None,
u'platform': u'plat1',
- u'id': 3,
- u'attributes': {}}]),
+ u'id': 3}]),
('get_hosts', {'hostname': 'host0'},
True,
[{u'status': u'Ready',
@@ -637,8 +636,7 @@
u'shard': None,
u'synch_id': None,
u'platform': u'plat0',
- u'id': 2,
- u'attributes': {}}]),
+ u'id': 2}]),
('get_acl_groups', {'hosts__hostname': 'host1'},
True,
[{u'description': u'',
@@ -699,8 +697,7 @@
u'invalid': False,
u'synch_id': None,
u'platform': u'plat0',
- u'id': 2,
- u'attributes': {}}]),
+ u'id': 2}]),
('get_acl_groups', {'hosts__hostname': 'host0'},
True,
[{u'description': u'',
@@ -750,8 +747,7 @@
u'invalid': False,
u'synch_id': None,
u'platform': u'plat0',
- u'id': 2,
- u'attributes': {}}]),
+ u'id': 2}]),
('get_acl_groups', {'hosts__hostname': 'host0'},
True,
[{u'description': u'',
@@ -799,8 +795,7 @@
u'invalid': False,
u'synch_id': None,
u'platform': u'plat1',
- u'id': 3,
- u'attributes': {}},
+ u'id': 3},
{u'status': u'Ready',
u'hostname': u'host0',
u'locked': False,
@@ -811,8 +806,7 @@
u'invalid': False,
u'synch_id': None,
u'platform': u'plat0',
- u'id': 2,
- u'attributes': {}}]),
+ u'id': 2}]),
('get_acl_groups', {'hosts__hostname': 'host1'},
True,
[{u'description': u'',
@@ -871,8 +865,7 @@
u'invalid': False,
u'synch_id': None,
u'platform': u'plat0',
- u'id': 5,
- u'attributes': {}}]),
+ u'id': 5}]),
('get_hosts', {'hostname__startswith': 'ho'},
True,
[{u'status': u'Ready',
@@ -885,8 +878,7 @@
u'invalid': False,
u'synch_id': None,
u'platform': u'plat1',
- u'id': 3,
- u'attributes': {}},
+ u'id': 3},
{u'status': u'Ready',
u'hostname': u'host0',
u'locked': False,
@@ -897,8 +889,7 @@
u'invalid': False,
u'synch_id': None,
u'platform': u'plat0',
- u'id': 2,
- u'attributes': {}}]),
+ u'id': 2}]),
('get_acl_groups', {'hosts__hostname': 'newhost0'},
True,
[{u'description': u'',
diff --git a/cli/topic_common.py b/cli/topic_common.py
index b191e6c..2ee42b8 100644
--- a/cli/topic_common.py
+++ b/cli/topic_common.py
@@ -666,23 +666,6 @@
return ' '.join(["%%-%ds" % lens[key] for key in keys])
- def print_dict(self, items, title=None, line_before=False):
- """Print a dictionary.
-
- @param items: Dictionary to print.
- @param title: Title of the output, default to None.
- @param line_before: True to print an empty line before the output,
- default to False.
- """
- if not items:
- return
- if line_before:
- print
- print title
- for key, value in items.items():
- print '%s : %s' % (key, value)
-
-
def print_table_std(self, items, keys_header, sublist_keys=()):
"""Print a mix of header and lists in a user readable format.
diff --git a/frontend/migrations/100_insert_ignore_auth_group_permissions.py b/frontend/migrations/100_insert_ignore_auth_group_permissions.py
deleted file mode 100644
index 802bf0f..0000000
--- a/frontend/migrations/100_insert_ignore_auth_group_permissions.py
+++ /dev/null
@@ -1,9 +0,0 @@
-UP_SQL = """
-SET @group_id = (SELECT id FROM auth_group WHERE name = 'Basic Admin');
-INSERT IGNORE INTO auth_group_permissions (group_id, permission_id)
-SELECT @group_id, id FROM auth_permission WHERE codename IN (
- 'add_hostattribute', 'change_hostattribute', 'delete_hostattribute');
-"""
-
-DOWN_SQL="""
-"""
diff --git a/server/hosts/servo_host.py b/server/hosts/servo_host.py
index cbe6099..c0f2a9b 100644
--- a/server/hosts/servo_host.py
+++ b/server/hosts/servo_host.py
@@ -25,17 +25,10 @@
from autotest_lib.client.common_lib.cros.network import ping_runner
from autotest_lib.server import site_utils as server_site_utils
from autotest_lib.server.cros.servo import servo
-from autotest_lib.server.cros.dynamic_suite import frontend_wrappers
from autotest_lib.server.hosts import ssh_host
from autotest_lib.site_utils.rpm_control_system import rpm_client
-# Names of the host attributes in the database that represent the values for
-# the servo_host and servo_port for a servo connected to the DUT.
-SERVO_HOST_ATTR = 'servo_host'
-SERVO_PORT_ATTR = 'servo_port'
-
-
class ServoHostException(error.AutoservError):
"""This is the base class for exceptions raised by ServoHost."""
pass
@@ -332,8 +325,6 @@
@raises ServoHostVerifyFailure if /var/lib/servod/config does not exist.
"""
- if self._is_localhost:
- return
try:
self.run('test -f /var/lib/servod/config')
except (error.AutoservRunError, error.AutoservSSHTimeout) as e:
@@ -653,19 +644,8 @@
@returns: A ServoHost object or None. See comments above.
"""
- if not utils.is_moblab():
- lab_servo_hostname = make_servo_hostname(dut)
- is_in_lab = utils.host_is_in_lab_zone(lab_servo_hostname)
- else:
- # Servos on Moblab are not in the actual lab.
- is_in_lab = False
- afe = frontend_wrappers.RetryingAFE(timeout_min=5, delay_sec=10)
- hosts = afe.get_hosts(hostname=dut)
- if hosts and SERVO_HOST_ATTR in hosts[0].attributes:
- servo_args = {}
- servo_args[SERVO_HOST_ATTR] = hosts[0].attributes[SERVO_HOST_ATTR]
- servo_args[SERVO_PORT_ATTR] = hosts[0].attributes.get(
- SERVO_PORT_ATTR, 9999)
+ lab_servo_hostname = make_servo_hostname(dut)
+ is_in_lab = utils.host_is_in_lab_zone(lab_servo_hostname)
if not is_in_lab:
if servo_args is None: