Skip to content

Commit

Permalink
Fix bug with promote script (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
omar-selo authored May 7, 2024
1 parent 57344c0 commit 0d6d5a0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
4 changes: 1 addition & 3 deletions backend/test_observer/controllers/promoter/promoter.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,7 @@ def run_deb_promoter(session: Session, artefact: Artefact) -> None:
assert series is not None, f"Series is not set for the artefact {artefact.id}"
assert repo is not None, f"Repo is not set for the artefact {artefact.id}"

architectures = session.scalars(queries.artefact_architectures(artefact.id))

for arch in architectures:
for arch in artefact.architectures:
for pocket in POCKET_PROMOTION_MAP:
with ArchiveManager(
arch=arch,
Expand Down
4 changes: 4 additions & 0 deletions backend/test_observer/data_access/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ class Artefact(Base):
status: Mapped[ArtefactStatus] = mapped_column(default=ArtefactStatus.UNDECIDED)
bug_link: Mapped[str] = mapped_column(default="")

@property
def architectures(self) -> set[str]:
return {ab.architecture for ab in self.builds}

__table_args__ = (
Index(
"unique_snap",
Expand Down
10 changes: 1 addition & 9 deletions backend/test_observer/data_access/queries.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from sqlalchemy import Select, select
from sqlalchemy import select

from test_observer.data_access.models import ArtefactBuild

Expand All @@ -11,11 +11,3 @@
ArtefactBuild.revision.desc(),
)
)


def artefact_architectures(artefact_id: int) -> Select[tuple[str]]:
return (
select(ArtefactBuild.architecture)
.distinct()
.where(ArtefactBuild.id == artefact_id)
)

0 comments on commit 0d6d5a0

Please sign in to comment.