properly expose AcquireByHash through the api

- new publish calls can now enable AcquireByHash by right away (previously
  one would have had to create a new publishing endpoint and then
  explicitly switch it to AcquireByHash)
- all json marshals of PublishedRepo now contain AcquireByHash (allows
  inspecting if a given endpoint has AcquireByHash enabled already; also
  enables verification that a switch/update actually applied a
  potential AcquireByHash change
- update all tests to reflect that default state of AcquireByHash
- update creation and switch testing to explicitly toggle AcquireByHash to
  make sure state mutation works as expected
This commit is contained in:
Harald Sitter
2018-01-15 17:04:05 +01:00
parent 1aa88701fb
commit 75c4d6da3b
3 changed files with 22 additions and 0 deletions
+5
View File
@@ -104,6 +104,7 @@ func apiPublishRepoOrSnapshot(c *gin.Context) {
SkipContents *bool
Architectures []string
Signing SigningOptions
AcquireByHash *bool
}
if c.Bind(&b) != nil {
@@ -201,6 +202,10 @@ func apiPublishRepoOrSnapshot(c *gin.Context) {
published.SkipContents = *b.SkipContents
}
if b.AcquireByHash != nil {
published.AcquireByHash = *b.AcquireByHash
}
duplicate := collection.CheckDuplicate(published)
if duplicate != nil {
context.CollectionFactory().PublishedRepoCollection().LoadComplete(duplicate, context.CollectionFactory())