diff --git a/api/publish.go b/api/publish.go index 7aa5afca..5ab7ccdb 100644 --- a/api/publish.go +++ b/api/publish.go @@ -267,7 +267,7 @@ func apiPublishRepoOrSnapshot(c *gin.Context) { return } - resources = append(resources, string(snapshot.ResourceKey())) + resources = append(resources, string(snapshot.Key())) sources = append(sources, snapshot) } } else if b.SourceKind == deb.SourceLocalRepo { @@ -499,7 +499,7 @@ func apiPublishUpdateSwitch(c *gin.Context) { AbortWithJSONError(c, http.StatusNotFound, err2) return } - resources = append(resources, string(snapshot.ResourceKey())) + resources = append(resources, string(snapshot.Key())) } } else { AbortWithJSONError(c, http.StatusInternalServerError, fmt.Errorf("unknown published repository type")) @@ -1177,7 +1177,7 @@ func apiPublishUpdate(c *gin.Context) { AbortWithJSONError(c, http.StatusNotFound, err2) return } - resources = append(resources, string(snapshot.ResourceKey())) + resources = append(resources, string(snapshot.Key())) } } diff --git a/api/repos.go b/api/repos.go index b8136403..fb002039 100644 --- a/api/repos.go +++ b/api/repos.go @@ -141,7 +141,7 @@ func apiReposCreate(c *gin.Context) { AbortWithJSONError(c, http.StatusNotFound, fmt.Errorf("source snapshot not found: %s", err)) return } - resources = append(resources, string(snapshot.ResourceKey())) + resources = append(resources, string(snapshot.Key())) } taskName := fmt.Sprintf("Create repository %s", b.Name) diff --git a/api/snapshot.go b/api/snapshot.go index 151c1fb1..7b6422f0 100644 --- a/api/snapshot.go +++ b/api/snapshot.go @@ -186,7 +186,7 @@ func apiSnapshotsCreate(c *gin.Context) { return } - resources = append(resources, string(sources[i].ResourceKey())) + resources = append(resources, string(sources[i].Key())) } maybeRunTaskInBackground(c, "Create snapshot "+b.Name, resources, func(_ aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) { @@ -375,7 +375,7 @@ func apiSnapshotsUpdate(c *gin.Context) { } } - resources := []string{string(snapshot.ResourceKey())} + resources := []string{string(snapshot.Key())} taskName := fmt.Sprintf("Update snapshot %s", name) maybeRunTaskInBackground(c, taskName, resources, func(_ aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) { @@ -470,7 +470,7 @@ func apiSnapshotsDrop(c *gin.Context) { return } - resources := []string{string(snapshot.ResourceKey())} + resources := []string{string(snapshot.Key())} taskName := fmt.Sprintf("Delete snapshot %s", name) maybeRunTaskInBackground(c, taskName, resources, func(_ aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) { @@ -668,7 +668,7 @@ func apiSnapshotsMerge(c *gin.Context) { return } - resources[i] = string(sources[i].ResourceKey()) + resources[i] = string(sources[i].Key()) } maybeRunTaskInBackground(c, "Merge snapshot "+name, resources, func(_ aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) { @@ -789,7 +789,7 @@ func apiSnapshotsPull(c *gin.Context) { return } - resources := []string{string(sourceSnapshot.ResourceKey()), string(toSnapshot.ResourceKey())} + resources := []string{string(sourceSnapshot.Key()), string(toSnapshot.Key())} taskName := fmt.Sprintf("Pull snapshot %s into %s and save as %s", body.Source, name, body.Destination) maybeRunTaskInBackground(c, taskName, resources, func(_ aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) { // Phase 2: Inside task lock - create fresh factory diff --git a/deb/snapshot.go b/deb/snapshot.go index f79a50d2..c308403c 100644 --- a/deb/snapshot.go +++ b/deb/snapshot.go @@ -143,12 +143,6 @@ func (s *Snapshot) Key() []byte { return []byte("S" + s.UUID) } -// ResourceKey is a unique identifier of the resource -// this snapshot uses. Instead of uuid it uses name -// which needs to be unique as well. -func (s *Snapshot) ResourceKey() []byte { - return []byte("S" + s.Name) -} // RefKey is a unique id for package reference list func (s *Snapshot) RefKey() []byte {