Clean up a bunch of unused/dead code.
Found code using vulture: http://pypi.python.org/pypi/vulture
BUG=chromium-os:36814
TEST=All unittests pass.
Change-Id: I55cd37d43fe794733936f73aacbaecaedd31b6bd
Reviewed-on: https://gerrit.chromium.org/gerrit/38968
Commit-Ready: Chris Sosa <sosa@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
diff --git a/autoupdate.py b/autoupdate.py
index 9b42eac..fb8d288 100644
--- a/autoupdate.py
+++ b/autoupdate.py
@@ -75,19 +75,6 @@
# Add entry to hosts' message log.
self.log.append(entry)
- def SetAttr(self, attr, value):
- """Set an attribute value."""
- self.attrs[attr] = value
-
- def GetAttr(self, attr):
- """Returns the value of an attribute."""
- if attr in self.attrs:
- return self.attrs[attr]
-
- def PopAttr(self, attr, default):
- """Returns and deletes a particular attribute."""
- return self.attrs.pop(attr, default)
-
class HostInfoTable:
"""Records information about a set of hosts who engage in update activity.
@@ -109,8 +96,7 @@
def GetHostInfo(self, host_id):
"""Return an info object for given host, if such exists."""
- if host_id in self.table:
- return self.table[host_id]
+ return self.table.get(host_id)
class Autoupdate(BuildObject):
@@ -234,18 +220,6 @@
# on the client if everything else matches.
return len(latest_tokens) > len(client_tokens)
- def _UnpackZip(self, image_dir):
- """Unpacks an image.zip into a given directory."""
- image = os.path.join(image_dir, self._GetImageName())
- if os.path.exists(image):
- return True
- else:
- # -n, never clobber an existing file, in case we get invoked
- # simultaneously by multiple request handlers. This means that
- # we're assuming each image.zip file lives in a versioned
- # directory (a la Buildbot).
- return os.system('cd %s && unzip -n image.zip' % image_dir) == 0
-
def _GetImageName(self):
"""Returns the name of the image that should be used."""
if self.use_test_image:
@@ -777,7 +751,7 @@
return autoupdate_lib.GetNoUpdateResponse(protocol)
# Check if an update has been forced for this client.
- forced_update = curr_host_info.PopAttr('forced_update_label', None)
+ forced_update = curr_host_info.attrs.pop('forced_update_label', None)
if forced_update:
label = forced_update