Store metadata about updates in a file alongside with payload.
This code includes a major refactoring to cleanup a lot of feature creep
that went into HandleUpdatePing. The feature that is introduced in this CL
is Store/Read from a metadata file on the system. This keeps us from
re-calculating the sha1/sha256/size of a payload each time we get a request
which will save us a lot of time and also pave the way for having the metadata
signature easily gettable. This follow from Get(Remote/Local)Attrs and is a
cache and re-calculated if necessary.
The cleanup in HandleUpdatePing mostly revolves around making sense of it and
dividing the parsing of app and event into separate methods.
A few other things -- I got rid of the pesky return None to indicate failure
and have switched to properly raising AutoupdateError's. I've also modified
the ridiculous use of returning the payload name (which is always the same
constant) to returning payload paths for clarification. I also removed the
unused and long dead factory code that's been stewing in here for a while.
Finally I updated _Log to actually do something similar to logging.log.
Specifically _Log() can now handle '%s %s blah blah %s', arg1, arg2, arg3
correctly.
BUG=chromium-os:36990
TEST=Unittests on all changed code, pylint on all changed files, ran update
on x86-generic image using both the serve_only and generate latest workflows.
Ran autoupdate_EndToEndTest
Change-Id: I3695b0903514eb6840e88810b8546fdca690819e
Reviewed-on: https://gerrit.chromium.org/gerrit/40996
Tested-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>
diff --git a/common_util.py b/common_util.py
index ec4c31b..3603004 100644
--- a/common_util.py
+++ b/common_util.py
@@ -23,8 +23,8 @@
# Module-local log function.
-def _Log(message, *args, **kwargs):
- return log_util.LogWithTag('UTIL', message, *args, **kwargs)
+def _Log(message, *args):
+ return log_util.LogWithTag('UTIL', message, *args)
AU_BASE = 'au'