]> git.ipfire.org Git - pbs.git/commitdiff
users: Automatically create the home repository
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 2 Jul 2025 15:01:43 +0000 (15:01 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 2 Jul 2025 15:01:43 +0000 (15:01 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/users.py

index 352f042868c31d6e732e12ec45d21192b6a22edf..e78fe00610d4f97161a4b43e3f7240215b01faa1 100644 (file)
@@ -910,7 +910,12 @@ class User(sqlmodel.SQLModel, database.BackendMixin, database.SoftDeleteMixin, t
                """
                # Return the "home" repository if slug is empty
                if slug is None:
-                       slug = self.name
+                       repo = await self.get_repo(distro, self.name)
+                       if repo:
+                               return repo
+
+                       # If the home repository does not exist, we automatically create it
+                       return await self.backend.repos.create(distro, name=self.name, owner=self)
 
                stmt = (
                        sqlalchemy