=== modified file 'lava_dashboard_tool/__init__.py'
@@ -20,4 +20,4 @@
Launch Control Tool package
"""
-__version__ = (0, 5, 3, "final", 0)
+__version__ = (0, 6, 0, "final", 0)
=== modified file 'lava_dashboard_tool/commands.py'
@@ -36,8 +36,9 @@
import simplejson
from linaro_json.extensions import datetime_extension
+from lava_tool.authtoken import AuthenticatingServerProxy, KeyringAuthBackend
+from lava_tool.commands import ExperimentalCommandMixIn
from lava_tool.interface import Command
-from lava_tool.commands import ExperimentalCommandMixIn
class InsufficientServerVersion(Exception):
@@ -312,8 +313,12 @@
Construct URL to the XML-RPC service out of the given URL
"""
parts = urlparse.urlsplit(url)
+ if not parts.path.endswith("/RPC2/"):
+ path = parts.path.rstrip("/") + "/xml-rpc/"
+ else:
+ path = parts.path
return urlparse.urlunsplit(
- (parts.scheme, parts.netloc, parts.path.rstrip("/") + "/xml-rpc/", "", ""))
+ (parts.scheme, parts.netloc, path, "", ""))
@staticmethod
def _strict_server_version(version):
@@ -365,8 +370,18 @@
def __init__(self, parser, args):
super(XMLRPCCommand, self).__init__(parser, args)
xml_rpc_url = self._construct_xml_rpc_url(self.args.dashboard_url)
- self.server = xmlrpclib.ServerProxy(xml_rpc_url, use_datetime=True,
- allow_none=True, verbose=args.verbose_xml_rpc)
+ self.server = AuthenticatingServerProxy(
+ xml_rpc_url,
+ verbose=args.verbose_xml_rpc,
+ allow_none=True,
+ use_datetime=True,
+ auth_backend=KeyringAuthBackend())
+
+ def use_non_legacy_api_if_possible(self, name='server'):
+ # Legacy APIs are registered in top-level object, non-legacy APIs are
+ # prefixed with extension name.
+ if "dashboard.version" in getattr(self, name).system.listMethods():
+ setattr(self, name, getattr(self, name).dashboard)
@classmethod
def register_arguments(cls, parser):
@@ -416,6 +431,7 @@
def invoke(self):
with self.safety_net():
+ self.use_non_legacy_api_if_possible()
return self.invoke_remote()
def handle_xmlrpc_fault(self, faultCode, faultString):
@@ -740,8 +756,13 @@
def __init__(self, parser, args):
super(pull, self).__init__(parser, args)
remote_xml_rpc_url = self._construct_xml_rpc_url(self.args.FROM)
- self.remote_server = xmlrpclib.ServerProxy(remote_xml_rpc_url, use_datetime=True,
- allow_none=True, verbose=args.verbose_xml_rpc)
+ self.remote_server = AuthenticatingServerProxy(
+ remote_xml_rpc_url,
+ verbose=args.verbose_xml_rpc,
+ use_datetime=True,
+ allow_none=True,
+ auth_backend=KeyringAuthBackend())
+ self.use_non_legacy_api_if_possible('remote_server')
@classmethod
def register_arguments(cls, parser):
@@ -781,6 +802,7 @@
def invoke_remote(self):
self._check_server_version(self.server, "0.3")
+
print "Checking local and remote streams"
remote = self.remote_server.streams()
if self.args.STREAM:
@@ -870,6 +892,7 @@
Probe the server for information about data views
"""
with self.safety_net():
+ self.use_non_legacy_api_if_possible()
self._check_server_version(self.server, "0.4")
return self.server.data_views()
@@ -907,6 +930,12 @@
default=argument["default"])
self.args = self.parser.parse_args(raw_args)
+ def invoke(self):
+ # Override and _not_ call 'use_non_legacy_api_if_possible' as we
+ # already did this reparse_arguments
+ with self.safety_net():
+ return self.invoke_remote()
+
def invoke_remote(self):
if self.data_views is None:
return -1