launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #06408
[Merge] lp:~allenap/maas/log-cobbler-interaction into lp:maas
Gavin Panella has proposed merging lp:~allenap/maas/log-cobbler-interaction into lp:maas.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~allenap/maas/log-cobbler-interaction/+merge/93566
--
https://code.launchpad.net/~allenap/maas/log-cobbler-interaction/+merge/93566
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/maas/log-cobbler-interaction into lp:maas.
=== modified file 'src/provisioningserver/cobblerclient.py'
--- src/provisioningserver/cobblerclient.py 2012-02-13 15:00:34 +0000
+++ src/provisioningserver/cobblerclient.py 2012-02-17 14:04:22 +0000
@@ -39,6 +39,7 @@
inlineCallbacks,
returnValue,
)
+from twisted.python.log import msg
from twisted.web.xmlrpc import Proxy
# Default timeout in seconds for xmlrpc requests to cobbler.
@@ -207,6 +208,22 @@
return passthrough
return d.addBoth(cancel_timeout)
+ def _log_call(self, method, args):
+ """Log the call.
+
+ If the authentication token placeholder is included in `args`, the
+ string ``<token>`` will be printed in its place; the token itself will
+ not be included.
+
+ :param method: The name of the method.
+ :param args: A sequence of arguments.
+ """
+ args_repr = ", ".join(
+ "<token>" if arg is self.token_placeholder else repr(arg)
+ for arg in args)
+ message = "%s(%s)" % (method, args_repr)
+ msg(message, system=__name__)
+
def _issue_call(self, method, *args):
"""Initiate call to XMLRPC method.
@@ -220,6 +237,7 @@
# we give it in Unicode. Encode it here; thankfully we're
# dealing with ASCII only in method names.
method = method.encode('ascii')
+ self._log_call(method, args)
args = map(self._substitute_token, args)
d = self._with_timeout(self.proxy.callRemote(method, *args))
return d