Merge ~r00ta/maas:lp-2060278 into maas:master

Proposed by Jacopo Rota
Status: Merged
Approved by: Jacopo Rota
Approved revision: fd2a0e79a193f42d8f2fdad04fdc7523a7e3ba69
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~r00ta/maas:lp-2060278
Merge into: maas:master
Diff against target: 25 lines (+5/-1)
2 files modified
src/maasserver/utils/bootresource.py (+1/-1)
src/tests/maasserver/utils/test_bootresource.py (+4/-0)
Reviewer Review Type Date Requested Status
MAAS Lander Approve
Anton Troyanov Approve
Review via email: mp+463732@code.launchpad.net

Commit message

fix: lp-2060278. Rename image sync lock file to match other maas lock files

Description of the change

Other maas lock files have the prefix `maas:` and in the postrm script we run

```
rm -f /run/lock/maas:*
```

This change aims to follow the same pattern also for bootresources locks.

To post a comment you must log in.
~r00ta/maas:lp-2060278 updated
2abc02c... by Jacopo Rota

add test

fd2a0e7... by Jacopo Rota

fix test

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

UNIT TESTS
-b lp-2060278 lp:~r00ta/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: fd2a0e79a193f42d8f2fdad04fdc7523a7e3ba69

review: Approve

Update scan failed

At least one of the branches involved have failed to scan. You can manually schedule a rescan if required.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/maasserver/utils/bootresource.py b/src/maasserver/utils/bootresource.py
2index e41abaa..46166e8 100644
3--- a/src/maasserver/utils/bootresource.py
4+++ b/src/maasserver/utils/bootresource.py
5@@ -270,7 +270,7 @@ class LocalBootResourceFile:
6
7 @property
8 def lock_file(self) -> Path:
9- return get_maas_lock_path() / f"bootres_{self.sha256}.lock"
10+ return get_maas_lock_path() / f"maas:bootres_{self.sha256}.lock"
11
12 def acquire_lock(self, try_lock: bool = False) -> bool:
13 if self._lock_fd is None:
14diff --git a/src/tests/maasserver/utils/test_bootresource.py b/src/tests/maasserver/utils/test_bootresource.py
15index 7f376f1..66ac4be 100644
16--- a/src/tests/maasserver/utils/test_bootresource.py
17+++ b/src/tests/maasserver/utils/test_bootresource.py
18@@ -187,3 +187,7 @@ class TestLocalBootResourceFile:
19 f = LocalBootResourceFile(sha256=file_sha256, total_size=FILE_SIZE)
20 assert f.acquire_lock(try_lock=True)
21 f.release_lock()
22+
23+ def test_lock_path(self, image_store_dir: Path, file_sha256: str):
24+ f = LocalBootResourceFile(sha256=file_sha256, total_size=FILE_SIZE)
25+ assert f.lock_file.name.startswith("maas:bootres_")

Subscribers

People subscribed via source and target branches