mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-31 04:30:44 +00:00
fix(publish): warn when distribution missing and resource key cannot be pre-registered
When b.Distribution is empty, the pre-registered resource key U<storage>:<prefix>>><distribution> cannot be constructed, so concurrent POST requests to the same prefix are not serialized by the task queue. Add a log warning so operators are aware of the gap.
This commit is contained in:
@@ -2,6 +2,7 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -307,6 +308,8 @@ func apiPublishRepoOrSnapshot(c *gin.Context) {
|
|||||||
storagePrefix = storage + ":" + prefix
|
storagePrefix = storage + ":" + prefix
|
||||||
}
|
}
|
||||||
resources = append(resources, "U"+storagePrefix+">>"+b.Distribution)
|
resources = append(resources, "U"+storagePrefix+">>"+b.Distribution)
|
||||||
|
} else {
|
||||||
|
log.Printf("distribution not specified for publish to prefix '%s' - unable to lock ", prefix)
|
||||||
}
|
}
|
||||||
|
|
||||||
taskName := fmt.Sprintf("Publish %s repository %s/%s with components \"%s\" and sources \"%s\"",
|
taskName := fmt.Sprintf("Publish %s repository %s/%s with components \"%s\" and sources \"%s\"",
|
||||||
|
|||||||
Reference in New Issue
Block a user