~launchpad-pqm/launchpad/devel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
Private XML-RPC ports
=====================

Several internal services require access to Launchpad data, typically over
XML-RPC.  Because these services are internal and the data they expose is not
needed by the outside world -- nor should it be -- Launchpad exposes an
internal port for these private XML-RPC end points.  These internal-only end
points are not available on the public XML-RPC port.

    >>> public_root = 'http://test@canonical.com:test@xmlrpc.launchpad.dev/'
    >>> private_root = 'http://xmlrpc-private.launchpad.dev:8087/'

For example, the team mailing list feature requires a connection between an
internal Mailman server and Launchpad.  This end point is not available on the
external XML-RPC port.

    >>> import xmlrpclib
    >>> from lp.testing.xmlrpc import XMLRPCTestTransport
    >>> external_api = xmlrpclib.ServerProxy(
    ...    public_root + 'mailinglists/',
    ...    transport=XMLRPCTestTransport())
    >>> external_api.getPendingActions()
    Traceback (most recent call last):
    ...
    ProtocolError: <ProtocolError for
    test@canonical.com:test@xmlrpc.launchpad.dev/mailinglists/:
    404 404 Not Found>

However, the end point is available on the internal port and does not require
authentication.

    >>> internal_api = xmlrpclib.ServerProxy(
    ...     private_root + 'mailinglists/',
    ...     transport=XMLRPCTestTransport())
    >>> internal_api.getPendingActions()
    {}

The bugs API on the other hand is an external service so it is available on
the external port.

    >>> external_api = xmlrpclib.ServerProxy(
    ...    public_root + 'bugs/',
    ...    transport=XMLRPCTestTransport())
    >>> external_api.filebug(dict(
    ...     product='firefox', summary='the summary', comment='the comment'))
    'http://bugs.launchpad.dev/bugs/16'

There is an interal bugs api, too, but that doesn't share the same
methods as those exposed publicly.

    >>> internal_api = xmlrpclib.ServerProxy(
    ...     private_root + 'bugs/',
    ...     transport=XMLRPCTestTransport())
    >>> internal_api.filebug(dict(
    ...     product='firefox', summary='the summary', comment='the comment'))
    Traceback (most recent call last):
    ...
    ProtocolError: <ProtocolError for xmlrpc-private.launchpad.dev:8087/bugs/:
    404 404 Not Found>

    >>> from zope.component import getUtility
    >>> from lp.services.verification.interfaces.logintoken import (
    ...     ILoginTokenSet)
    >>> token_string = internal_api.newBugTrackerToken()
    >>> token = getUtility(ILoginTokenSet)[token_string]
    >>> token
    <LoginToken at ...>