[autotest] Move check out of decorated wrapper

This check can and should be done during decoration time, not when the
decorated function is called.

BUG=None
TEST=None

Change-Id: I1112b23f7aea66c3dd8c2f5244c9ebcd4f4630f6
Reviewed-on: https://chromium-review.googlesource.com/419084
Commit-Ready: Allen Li <ayatane@chromium.org>
Tested-by: Allen Li <ayatane@chromium.org>
Reviewed-by: Allen Li <ayatane@chromium.org>
diff --git a/frontend/afe/rpc_utils.py b/frontend/afe/rpc_utils.py
index 58fa4fb..3b02dec 100644
--- a/frontend/afe/rpc_utils.py
+++ b/frontend/afe/rpc_utils.py
@@ -1302,6 +1302,10 @@
 
     @returns: A function replacing the RPC func.
     """
+    argspec = inspect.getargspec(func)
+    if argspec.varargs is not None:
+        raise Exception('RPC function must not have *args.')
+
     @wraps(func)
     def replacement(*args, **kwargs):
         """
@@ -1331,9 +1335,6 @@
 
         {'a':1, 'b':2, 'id':3, 'name':'mk'}
         """
-        argspec = inspect.getargspec(func)
-        if argspec.varargs is not None:
-            raise Exception('RPC function must not have *args.')
         funcargs = inspect.getcallargs(func, *args, **kwargs)
         kwargs = dict()
         for k, v in funcargs.iteritems():
@@ -1348,6 +1349,7 @@
                     user=thread_local.get_user())
             return afe.run(func.func_name, **kwargs)
         return func(**kwargs)
+
     return replacement