← Back to team overview

launchpad-reviewers team mailing list archive

Re: [Merge] ~ines-almeida/launchpad:fetch-service-update-end-session into launchpad:master

 


Diff comments:

> diff --git a/lib/lp/buildmaster/builderproxy.py b/lib/lp/buildmaster/builderproxy.py
> index 1fc0d9b..88f1792 100644
> --- a/lib/lp/buildmaster/builderproxy.py
> +++ b/lib/lp/buildmaster/builderproxy.py
> @@ -290,8 +282,20 @@ class FetchService(IProxyService):
>              "revocation_endpoint": revocation_endpoint,
>          }
>  
> +    def parseRevocationEndpoint(self, revocation_endpoint: str) -> str:
> +        """Helper method to get the session_id out of the revocation
> +        endpoint."""

For these kind of parsers it is always helpful to have an example string added as a comment.

> +        re_pattern = self.TOKEN_REVOCATION.format(
> +            control_endpoint=self.control_endpoint,
> +            session_id="(?P<session_id>.*)",
> +        )
> +        match = re.match(re_pattern, revocation_endpoint)
> +        return match["session_id"] if match else None
> +
>      @defer.inlineCallbacks
> -    def retrieveMetadataFromSession(self, save_content_to: str):
> +    def retrieveMetadataFromSession(
> +        self, session_id: str, save_content_to: str
> +    ):
>          """Make request to retrieve metadata from the current session.
>  
>          Data is stored directly into a file whose path is `save_content_to`
> diff --git a/lib/lp/buildmaster/tests/mock_workers.py b/lib/lp/buildmaster/tests/mock_workers.py
> index a880a9a..0a4a21f 100644
> --- a/lib/lp/buildmaster/tests/mock_workers.py
> +++ b/lib/lp/buildmaster/tests/mock_workers.py
> @@ -151,6 +151,15 @@ class OkWorker:
>          self.call_log.append("info")
>          return defer.succeed(("1.0", self.arch_tag, "binarypackage"))
>  
> +    def proxy_info(self):
> +        self.call_log.append("proxy_info")
> +        return defer.succeed(
> +            {
> +                "revocation_endpoint": "https://proxy.test.net/revoke_token";,

What about adding a session id to the URL?

> +                "use_fetch_service": False,
> +            }
> +        )
> +
>      def resume(self):
>          self.call_log.append("resume")
>          return defer.succeed(("", "", 0))


-- 
https://code.launchpad.net/~ines-almeida/launchpad/+git/launchpad/+merge/465152
Your team Launchpad code reviewers is requested to review the proposed merge of ~ines-almeida/launchpad:fetch-service-update-end-session into launchpad:master.



References