launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #18458
[Merge] lp:~cjwatson/launchpad/drop-old-sca-api into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/drop-old-sca-api into lp:launchpad.
Commit message:
Drop the old softwarecenteragent xmlrpc-private endpoint.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/drop-old-sca-api/+merge/258185
Now that a version of software-center-agent has been deployed that doesn't rely on it, we can drop the old softwarecenteragent xmlrpc-private endpoint and withdraw SCA's access to the private port.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/drop-old-sca-api into lp:launchpad.
=== modified file 'lib/lp/registry/configure.zcml'
--- lib/lp/registry/configure.zcml 2015-03-09 11:37:50 +0000
+++ lib/lp/registry/configure.zcml 2015-05-04 15:08:46 +0000
@@ -1188,16 +1188,6 @@
class="lp.registry.xmlrpc.mailinglist.MailingListAPIView"
permission="zope.Public"/>
<securedutility
- class="lp.registry.xmlrpc.softwarecenteragent.SoftwareCenterAgentApplication"
- provides="lp.registry.interfaces.person.ISoftwareCenterAgentApplication">
- <allow interface="lp.registry.interfaces.person.ISoftwareCenterAgentApplication" />
- </securedutility>
- <xmlrpc:view
- for="lp.registry.interfaces.person.ISoftwareCenterAgentApplication"
- interface="lp.registry.interfaces.person.ISoftwareCenterAgentAPI"
- class="lp.registry.xmlrpc.softwarecenteragent.SoftwareCenterAgentAPI"
- permission="zope.Public"/>
- <securedutility
class="lp.registry.xmlrpc.canonicalsso.CanonicalSSOApplication"
provides="lp.registry.interfaces.person.ICanonicalSSOApplication">
<allow interface="lp.registry.interfaces.person.ICanonicalSSOApplication" />
=== modified file 'lib/lp/registry/interfaces/person.py'
--- lib/lp/registry/interfaces/person.py 2015-04-28 15:54:00 +0000
+++ lib/lp/registry/interfaces/person.py 2015-05-04 15:08:46 +0000
@@ -21,8 +21,6 @@
'IPersonLimitedView',
'IPersonViewRestricted',
'IRequestPeopleMerge',
- 'ISoftwareCenterAgentAPI',
- 'ISoftwareCenterAgentApplication',
'ITeam',
'ITeamContactAddressForm',
'ITeamReassignment',
@@ -2497,38 +2495,17 @@
required=True, vocabulary=TeamContactMethod)
-class ISoftwareCenterAgentAPI(Interface):
- """XMLRPC API used by the software center agent."""
-
- def getOrCreateSoftwareCenterCustomer(openid_identifier, email,
- full_name):
- """Get or create an LP person based on a given identifier.
-
- See the method of the same name on `IPersonSet`. This XMLRPC version
- doesn't require the creation rationale and comment.
-
- This is added as a private XMLRPC method instead of exposing via the
- API as it should not be needed long-term. Long term we should allow
- the software center to create subscriptions to private PPAs without
- requiring a Launchpad account.
- """
-
-
class ICanonicalSSOApplication(ILaunchpadApplication):
"""XMLRPC application root for ICanonicalSSOAPI."""
class ICanonicalSSOAPI(Interface):
- """XMLRPC API used by the software center agent."""
+ """XMLRPC API used by Canonical SSO."""
def getPersonDetailsByOpenIDIdentifier(openid_identifier):
"""Get the details of an LP person based on an OpenID identifier."""
-class ISoftwareCenterAgentApplication(ILaunchpadApplication):
- """XMLRPC application root for ISoftwareCenterAgentAPI."""
-
-
@error_status(httplib.FORBIDDEN)
class ImmutableVisibilityError(Exception):
"""A change in team membership visibility is not allowed."""
=== modified file 'lib/lp/registry/tests/test_xmlrpc.py'
--- lib/lp/registry/tests/test_xmlrpc.py 2012-08-14 23:27:07 +0000
+++ lib/lp/registry/tests/test_xmlrpc.py 2015-05-04 15:08:46 +0000
@@ -7,134 +7,12 @@
import xmlrpclib
-from zope.component import getUtility
from zope.security.proxy import removeSecurityProxy
from lp.registry.enums import PersonVisibility
-from lp.registry.interfaces.person import (
- IPersonSet,
- ISoftwareCenterAgentAPI,
- ISoftwareCenterAgentApplication,
- PersonCreationRationale,
- )
-from lp.registry.xmlrpc.softwarecenteragent import SoftwareCenterAgentAPI
-from lp.services.identity.interfaces.account import AccountStatus
-from lp.services.webapp.servers import LaunchpadTestRequest
from lp.testing import TestCaseWithFactory
from lp.testing.layers import DatabaseFunctionalLayer
from lp.testing.xmlrpc import XMLRPCTestTransport
-from lp.xmlrpc.interfaces import IPrivateApplication
-
-
-class TestSoftwareCenterAgentAPI(TestCaseWithFactory):
-
- layer = DatabaseFunctionalLayer
-
- def setUp(self):
- super(TestSoftwareCenterAgentAPI, self).setUp()
- self.private_root = getUtility(IPrivateApplication)
- self.sca_api = SoftwareCenterAgentAPI(
- context=self.private_root.softwarecenteragent,
- request=LaunchpadTestRequest())
-
- def test_provides_interface(self):
- # The view interface is provided.
- self.assertProvides(self.sca_api, ISoftwareCenterAgentAPI)
-
- def test_getOrCreateSoftwareCenterCustomer(self):
- # The method returns the username of the person, and sets the
- # correct creation rational/comment.
- user_name = self.sca_api.getOrCreateSoftwareCenterCustomer(
- u'openid-ident', 'alice@xxxxx', 'Joe Blogs')
-
- self.assertEqual('alice', user_name)
- person = getUtility(IPersonSet).getByName(user_name)
- self.assertEqual(
- 'openid-ident', removeSecurityProxy(
- person.account).openid_identifiers.any().identifier)
- self.assertEqual(
- PersonCreationRationale.SOFTWARE_CENTER_PURCHASE,
- person.creation_rationale)
- self.assertEqual(
- "when purchasing an application via Software Center.",
- person.creation_comment)
-
-
-class TestSoftwareCenterAgentApplication(TestCaseWithFactory):
-
- layer = DatabaseFunctionalLayer
-
- def setUp(self):
- super(TestSoftwareCenterAgentApplication, self).setUp()
- self.private_root = getUtility(IPrivateApplication)
- self.rpc_proxy = xmlrpclib.ServerProxy(
- 'http://xmlrpc-private.launchpad.dev:8087/softwarecenteragent',
- transport=XMLRPCTestTransport())
-
- def test_provides_interface(self):
- # The application is provided.
- self.assertProvides(
- self.private_root.softwarecenteragent,
- ISoftwareCenterAgentApplication)
-
- def test_getOrCreateSoftwareCenterCustomer_xmlrpc(self):
- # The method can be called via xmlrpc
- user_name = self.rpc_proxy.getOrCreateSoftwareCenterCustomer(
- u'openid-ident', 'a@xxxxx', 'Joe Blogs')
- person = getUtility(IPersonSet).getByName(user_name)
- self.assertEqual(
- u'openid-ident',
- removeSecurityProxy(
- person.account).openid_identifiers.any().identifier)
-
- def test_getOrCreateSoftwareCenterCustomer_xmlrpc_suspended(self):
- # A suspended account results in an appropriate xmlrpc fault.
- suspended_person = self.factory.makePerson(
- displayname='Joe Blogs', email='a@xxxxx',
- account_status=AccountStatus.SUSPENDED)
- openid_identifier = removeSecurityProxy(
- suspended_person.account).openid_identifiers.any().identifier
-
- # assertRaises doesn't let us check the type of Fault.
- fault_raised = False
- try:
- self.rpc_proxy.getOrCreateSoftwareCenterCustomer(
- openid_identifier, 'a@xxxxx', 'Joe Blogs')
- except xmlrpclib.Fault as e:
- fault_raised = True
- self.assertEqual(370, e.faultCode)
- self.assertIn(openid_identifier, e.faultString)
-
- self.assertTrue(fault_raised)
-
- def test_getOrCreateSoftwareCenterCustomer_xmlrpc_team(self):
- # A team email address results in an appropriate xmlrpc fault.
- self.factory.makeTeam(email='a@xxxxx')
-
- # assertRaises doesn't let us check the type of Fault.
- fault_raised = False
- try:
- self.rpc_proxy.getOrCreateSoftwareCenterCustomer(
- 'foo', 'a@xxxxx', 'Joe Blogs')
- except xmlrpclib.Fault as e:
- fault_raised = True
- self.assertEqual(400, e.faultCode)
- self.assertIn('a@xxxxx', e.faultString)
-
- self.assertTrue(fault_raised)
-
- def test_not_available_on_public_api(self):
- # The person set api is not available on the public xmlrpc
- # service.
- public_rpc_proxy = xmlrpclib.ServerProxy(
- 'http://test@xxxxxxxxxxxxx:test@'
- 'xmlrpc.launchpad.dev/softwarecenteragent',
- transport=XMLRPCTestTransport())
- e = self.assertRaises(
- xmlrpclib.ProtocolError,
- public_rpc_proxy.getOrCreateSoftwareCenterCustomer,
- 'openid-ident', 'a@xxxxx', 'Joe Blogs')
- self.assertEqual(404, e.errcode)
class TestCanonicalSSOApplication(TestCaseWithFactory):
=== removed file 'lib/lp/registry/xmlrpc/softwarecenteragent.py'
--- lib/lp/registry/xmlrpc/softwarecenteragent.py 2012-01-20 06:58:13 +0000
+++ lib/lp/registry/xmlrpc/softwarecenteragent.py 1970-01-01 00:00:00 +0000
@@ -1,52 +0,0 @@
-# Copyright 2010-2011 Canonical Ltd. This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-"""XMLRPC APIs for person set."""
-
-__metaclass__ = type
-__all__ = [
- 'SoftwareCenterAgentAPI',
- ]
-
-
-from zope.component import getUtility
-from zope.interface import implements
-
-from lp.registry.interfaces.person import (
- IPersonSet,
- ISoftwareCenterAgentAPI,
- ISoftwareCenterAgentApplication,
- PersonCreationRationale,
- TeamEmailAddressError,
- )
-from lp.services.identity.interfaces.account import AccountSuspendedError
-from lp.services.webapp import LaunchpadXMLRPCView
-from lp.xmlrpc import faults
-
-
-class SoftwareCenterAgentAPI(LaunchpadXMLRPCView):
- """See `ISoftwareCenterAgentAPI`."""
-
- implements(ISoftwareCenterAgentAPI)
-
- def getOrCreateSoftwareCenterCustomer(self, openid_identifier, email,
- full_name):
- try:
- person, db_updated = getUtility(
- IPersonSet).getOrCreateByOpenIDIdentifier(
- openid_identifier.decode('ASCII'), email, full_name,
- PersonCreationRationale.SOFTWARE_CENTER_PURCHASE,
- "when purchasing an application via Software Center.")
- except AccountSuspendedError:
- return faults.AccountSuspended(openid_identifier)
- except TeamEmailAddressError:
- return faults.TeamEmailAddress(email, openid_identifier)
-
- return person.name
-
-
-class SoftwareCenterAgentApplication:
- """Software center agent end-point."""
- implements(ISoftwareCenterAgentApplication)
-
- title = "Software Center Agent API"
=== modified file 'lib/lp/xmlrpc/application.py'
--- lib/lp/xmlrpc/application.py 2015-03-03 01:48:18 +0000
+++ lib/lp/xmlrpc/application.py 2015-05-04 15:08:46 +0000
@@ -26,10 +26,7 @@
)
from lp.code.interfaces.gitapi import IGitApplication
from lp.registry.interfaces.mailinglist import IMailingListApplication
-from lp.registry.interfaces.person import (
- ICanonicalSSOApplication,
- ISoftwareCenterAgentApplication,
- )
+from lp.registry.interfaces.person import ICanonicalSSOApplication
from lp.services.authserver.interfaces import IAuthServerApplication
from lp.services.features.xmlrpc import IFeatureFlagApplication
from lp.services.webapp import LaunchpadXMLRPCView
@@ -67,11 +64,6 @@
return getUtility(IPrivateMaloneApplication)
@property
- def softwarecenteragent(self):
- """See `IPrivateApplication`."""
- return getUtility(ISoftwareCenterAgentApplication)
-
- @property
def canonicalsso(self):
"""See `IPrivateApplication`."""
return getUtility(ICanonicalSSOApplication)
=== modified file 'lib/lp/xmlrpc/configure.zcml'
--- lib/lp/xmlrpc/configure.zcml 2015-03-03 14:15:09 +0000
+++ lib/lp/xmlrpc/configure.zcml 2015-05-04 15:08:46 +0000
@@ -211,12 +211,6 @@
<require like_class="xmlrpclib.Fault" />
</class>
- <class class="lp.xmlrpc.faults.AccountSuspended">
- <require like_class="xmlrpclib.Fault" />
- </class>
- <class class="lp.xmlrpc.faults.TeamEmailAddress">
- <require like_class="xmlrpclib.Fault" />
- </class>
<class class="lp.xmlrpc.faults.InvalidSourcePackageName">
<require like_class="xmlrpclib.Fault" />
</class>
=== modified file 'lib/lp/xmlrpc/faults.py'
--- lib/lp/xmlrpc/faults.py 2015-03-03 14:15:09 +0000
+++ lib/lp/xmlrpc/faults.py 2015-05-04 15:08:46 +0000
@@ -9,7 +9,6 @@
__metaclass__ = type
__all__ = [
- 'AccountSuspended',
'BadStatus',
'BranchAlreadyRegistered',
'BranchCreationForbidden',
@@ -46,7 +45,6 @@
'PathTranslationError',
'PermissionDenied',
'RequiredParameterMissing',
- 'TeamEmailAddress',
'Unauthorized',
'UnexpectedStatusReport',
]
@@ -463,18 +461,6 @@
LaunchpadFault.__init__(self, job_id=job_id)
-class AccountSuspended(LaunchpadFault):
- """Raised by `ISoftwareCenterAgentAPI` when an account is suspended."""
-
- error_code = 370
- msg_template = (
- 'The openid_identifier \'%(openid_identifier)s\''
- ' is linked to a suspended account.')
-
- def __init__(self, openid_identifier):
- LaunchpadFault.__init__(self, openid_identifier=openid_identifier)
-
-
class OopsOccurred(LaunchpadFault):
"""An oops has occurred performing the requested operation."""
@@ -498,20 +484,6 @@
LaunchpadFault.__init__(self, name=name)
-class TeamEmailAddress(LaunchpadFault):
- """Raised by `ISoftwareCenterAgentAPI` when an email address is a team."""
-
- error_code = 400
- msg_template = (
- 'The email address \'%(email)s\' '
- '(openid_identifier \'%(openid_identifier)s\') '
- 'is linked to a Launchpad team.')
-
- def __init__(self, email, openid_identifier):
- LaunchpadFault.__init__(
- self, email=email, openid_identifier=openid_identifier)
-
-
# American English spelling to line up with httplib etc.
class Unauthorized(LaunchpadFault):
"""Permission was denied, but authorisation may help."""
=== modified file 'lib/lp/xmlrpc/interfaces.py'
--- lib/lp/xmlrpc/interfaces.py 2015-03-03 01:48:18 +0000
+++ lib/lp/xmlrpc/interfaces.py 2015-05-04 15:08:46 +0000
@@ -27,9 +27,6 @@
bugs = Attribute("""Launchpad Bugs XML-RPC end point.""")
- softwarecenteragent = Attribute(
- """Software center agent XML-RPC end point.""")
-
canonicalsso = Attribute(
"""Canonical SSO XML-RPC end point.""")
Follow ups