← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~pelpsi/launchpad:requestProxyToken-function-refactor into launchpad:master

 

Simone Pelosi has proposed merging ~pelpsi/launchpad:requestProxyToken-function-refactor into launchpad:master.

Commit message:
Refactor _requestProxyToken to be aligned with _requestFetchServiceSession

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~pelpsi/launchpad/+git/launchpad/+merge/462145
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~pelpsi/launchpad:requestProxyToken-function-refactor into launchpad:master.
diff --git a/lib/lp/buildmaster/builderproxy.py b/lib/lp/buildmaster/builderproxy.py
index 1ac121f..75e049f 100644
--- a/lib/lp/buildmaster/builderproxy.py
+++ b/lib/lp/buildmaster/builderproxy.py
@@ -1,4 +1,4 @@
-# Copyright 2015-2021 Canonical Ltd.  This software is licensed under the
+# Copyright 2015-2024 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Builder proxy support.
@@ -84,23 +84,11 @@ class BuilderProxyMixin:
 
     @defer.inlineCallbacks
     def _requestProxyToken(self):
-        admin_username = _get_proxy_config(
+        admin_username = _get_value_from_config(
             "builder_proxy_auth_api_admin_username"
         )
-        if not admin_username:
-            raise CannotBuild(
-                "builder_proxy_auth_api_admin_username is not configured."
-            )
-        secret = _get_proxy_config("builder_proxy_auth_api_admin_secret")
-        if not secret:
-            raise CannotBuild(
-                "builder_proxy_auth_api_admin_secret is not configured."
-            )
-        url = _get_proxy_config("builder_proxy_auth_api_endpoint")
-        if not secret:
-            raise CannotBuild(
-                "builder_proxy_auth_api_endpoint is not configured."
-            )
+        secret = _get_value_from_config("builder_proxy_auth_api_admin_secret")
+        url = _get_value_from_config("builder_proxy_auth_api_endpoint")
         timestamp = int(time.time())
         proxy_username = "{build_id}-{timestamp}".format(
             build_id=self.build.build_cookie, timestamp=timestamp