Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/bug-979409 into lp:maas.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #979409 in MAAS: "Breaks during reconcile"
  https://bugs.launchpad.net/maas/+bug/979409

For more details, see:
https://code.launchpad.net/~jtv/maas/bug-979409/+merge/101665

Scott ran into a little kaboomski while running the reconcile script.  The 
traceback seemed to make no sense at all, going from ProvisioningProxy (which 
wraps a remote XMLRPC method) into xmlrpclib (and seemingly, an attempt at 
invoking a remote method) while looking up the method's name in one of its 
policy dicts.

Here's what I think happened: the attempt to access method.__name__ tickled the 
proxy's __getattr__, which is where the tie to the remote method happens.  And 
so, the attempt to read __name__ went through almost all the motions needed for 
invoking a remote method.  Not quite all, and it's probably in that difference 
somewhere that things went haywire.

To avoid the problem, just keep track of the method's name ourselves!  We've 
got it anyway.  Pass it to the ProvisioningProxy, and done.  This solves 
Scott's problem.
-- 
https://code.launchpad.net/~jtv/maas/bug-979409/+merge/101665
Your team Launchpad code reviewers is requested to review the proposed merge of 
lp:~jtv/maas/bug-979409 into lp:maas.
=== modified file 'src/maasserver/provisioning.py'
--- src/maasserver/provisioning.py	2012-04-11 15:50:10 +0000
+++ src/maasserver/provisioning.py	2012-04-11 23:28:18 +0000
@@ -214,7 +214,8 @@
     - Registers failing/working components.
     """
 
-    def __init__(self, method):
+    def __init__(self, method_name, method):
+        self.method_name = method_name
         self.method = method
 
     def __call__(self, *args, **kwargs):
@@ -222,7 +223,7 @@
             result = self.method(*args, **kwargs)
             # The call was a success, discard persistent errors for
             # components referenced by this method.
-            register_working_components(self.method.__name__)
+            register_working_components(self.method_name)
             return result
         except xmlrpclib.Fault as e:
             # Register failing component.
@@ -257,7 +258,7 @@
             return attribute
         else:
             # This attribute is callable.  Wrap it in a caller.
-            return ProvisioningCaller(attribute)
+            return ProvisioningCaller(attribute_name, attribute)
 
 
 def get_provisioning_api_proxy():

_______________________________________________
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help   : https://help.launchpad.net/ListHelp

Reply via email to