Merge ~r00ta/maas:lp-2058037-3.5 into maas:3.5

Proposed by Jacopo Rota
Status: Merged
Approved by: Jacopo Rota
Approved revision: 63a95907a74e79ac7f503e479141d44897c7cd27
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~r00ta/maas:lp-2058037-3.5
Merge into: maas:3.5
Diff against target: 33 lines (+15/-7)
1 file modified
src/maasserver/workflow/bootresource.py (+15/-7)
Reviewer Review Type Date Requested Status
MAAS Lander Approve
Jacopo Rota Approve
Review via email: mp+462580@code.launchpad.net

This proposal supersedes a proposal from 2024-03-18.

Commit message

fix: lp-2058037. Ensure get-bootresourcefile-endpoints activity fails if the region is not exposing its ip yet.

(cherry-picked from 81a99768c3098a9fbd76f8de1e27ea8433af04ba)

To post a comment you must log in.
Revision history for this message
Jacopo Rota (r00ta) wrote :

self approving backport

review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b lp-2058037-3.5 lp:~r00ta/maas/+git/maas into -b 3.5 lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: 63a95907a74e79ac7f503e479141d44897c7cd27

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/maasserver/workflow/bootresource.py b/src/maasserver/workflow/bootresource.py
2index 4c76a5e..4097f7e 100644
3--- a/src/maasserver/workflow/bootresource.py
4+++ b/src/maasserver/workflow/bootresource.py
5@@ -97,13 +97,21 @@ class BootResourcesActivity(MAASAPIClient):
6 async def get_bootresourcefile_endpoints(self) -> dict[str, list]:
7 url = f"{self.url}/api/2.0/regioncontrollers/"
8 regions = await self.request_async("GET", url)
9- return {
10- r["system_id"]: [
11- compose_URL("http://:5240/MAAS/boot-resources/", src)
12- for src in r["ip_addresses"]
13- ]
14- for r in regions
15- }
16+ regions_endpoints = {}
17+ for region in regions:
18+ # https://bugs.launchpad.net/maas/+bug/2058037
19+ if region["ip_addresses"]:
20+ regions_endpoints[region["system_id"]] = [
21+ compose_URL("http://:5240/MAAS/boot-resources/", src)
22+ for src in region["ip_addresses"]
23+ ]
24+ else:
25+ raise ApplicationError(
26+ f"Could not retrieve the IP addresses of the region controller '{region['system_id']}' from the API. This "
27+ f"activity will be retried until we have the IP for all the region controllers.",
28+ non_retryable=False,
29+ )
30+ return regions_endpoints
31
32 @activity.defn(name="download-bootresourcefile")
33 async def download_bootresourcefile(

Subscribers

People subscribed via source and target branches