mirror of
https://github.com/rocky-linux/peridot.git
synced 2024-12-21 02:08:29 +00:00
Peridot: Fix MakeActiveInRepo - Only set for current project
Current behavior sets active package version in repo for all projects even though yumrepofs is only updating for a specific project. This fixes it by only setting active package version in repo for that specific version in that specific project.
This commit is contained in:
parent
850c4b93bb
commit
a143c18b94
@ -1477,7 +1477,7 @@ func (c *Controller) makeRepoChanges(tx peridotdb.Access, req *UpdateRepoRequest
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !req.DisableSetActive {
|
if !req.DisableSetActive {
|
||||||
err = tx.MakeActiveInRepoForPackageVersion(build.PackageVersionId, build.PackageId)
|
err = tx.MakeActiveInRepoForPackageVersion(build.PackageVersionId, build.PackageId, build.ProjectId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.log.Errorf("failed to set active build for project %s, package %s: %s", project.ID.String(), packageName, err)
|
c.log.Errorf("failed to set active build for project %s, package %s: %s", project.ID.String(), packageName, err)
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -93,7 +93,7 @@ type Access interface {
|
|||||||
AttachPackageVersion(projectId string, packageId string, packageVersionId string, active bool) error
|
AttachPackageVersion(projectId string, packageId string, packageVersionId string, active bool) error
|
||||||
GetProjectPackageVersionFromPackageVersionId(packageVersionId string, projectId string) (string, error)
|
GetProjectPackageVersionFromPackageVersionId(packageVersionId string, projectId string) (string, error)
|
||||||
DeactivateProjectPackageVersionByPackageIdAndProjectId(packageId string, projectId string) error
|
DeactivateProjectPackageVersionByPackageIdAndProjectId(packageId string, projectId string) error
|
||||||
MakeActiveInRepoForPackageVersion(packageVersionId string, packageId string) error
|
MakeActiveInRepoForPackageVersion(packageVersionId string, packageId string, projectId string) error
|
||||||
CreatePackage(name string, packageType peridotpb.PackageType) (*models.Package, error)
|
CreatePackage(name string, packageType peridotpb.PackageType) (*models.Package, error)
|
||||||
AddPackageToProject(projectId string, packageId string, packageTypeOverride peridotpb.PackageType) error
|
AddPackageToProject(projectId string, packageId string, packageTypeOverride peridotpb.PackageType) error
|
||||||
GetPackageID(name string) (string, error)
|
GetPackageID(name string) (string, error)
|
||||||
|
@ -242,18 +242,18 @@ func (a *Access) DeactivateProjectPackageVersionByPackageIdAndProjectId(packageI
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Access) MakeActiveInRepoForPackageVersion(packageVersionId string, packageId string) error {
|
func (a *Access) MakeActiveInRepoForPackageVersion(packageVersionId string, packageId string, projectId string) error {
|
||||||
tx, err := a.Begin()
|
tx, err := a.Begin()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = tx.Exec("update project_package_versions set active_in_repo = false where package_id = $1", packageId)
|
_, err = tx.Exec("update project_package_versions set active_in_repo = false where package_id = $1 and project_id = $2", packageId, projectId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = tx.Exec("update project_package_versions set active_in_repo = true where package_version_id = $1", packageVersionId)
|
_, err = tx.Exec("update project_package_versions set active_in_repo = true where package_version_id = $1 and project_id = $2", packageVersionId, projectId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user