From 75077cf91a67f6c59d01c75237708e9a8142d1bf Mon Sep 17 00:00:00 2001 From: Kasey Date: Mon, 10 Dec 2018 14:46:31 -0500 Subject: [PATCH] fix(publish): api publish endpoint and CanonicalizeDatasetRef fix - api publish endpoint needs to check if the dataset should or should not be pinned - CanonicalizeDatasetRef needs to pass over the Published status of the on file dataset ref --- actions/actions.go | 4 ++++ api/datasets.go | 5 +++-- repo/ref.go | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/actions/actions.go b/actions/actions.go index 56508c794..81647d90b 100644 --- a/actions/actions.go +++ b/actions/actions.go @@ -8,3 +8,7 @@ import ( ) var log = golog.Logger("actions") + +func init() { + golog.SetLogLevel("actions", "info") +} diff --git a/api/datasets.go b/api/datasets.go index 7fc9cfcd7..e79dd80b6 100644 --- a/api/datasets.go +++ b/api/datasets.go @@ -663,8 +663,9 @@ func (h DatasetHandlers) publishHandler(w http.ResponseWriter, r *http.Request, ref.Published = publish p := &lib.SetPublishStatusParams{ - Ref: &ref, - UpdateRegistry: r.FormValue("no_registry") != "true", + Ref: &ref, + UpdateRegistry: r.FormValue("no_registry") != "true", + UpdateRegistryPin: r.FormValue("no_pin") != "true", } var ok bool if err := h.DatasetRequests.SetPublishStatus(p, &ok); err != nil { diff --git a/repo/ref.go b/repo/ref.go index 4707d190b..8848fb12e 100644 --- a/repo/ref.go +++ b/repo/ref.go @@ -378,6 +378,7 @@ func CanonicalizeDatasetRef(r Repo, ref *DatasetRef) error { if ref.Peername == "" { ref.Peername = got.Peername } + ref.Published = got.Published if ref.Path != got.Path || ref.ProfileID != got.ProfileID || ref.Name != got.Name || ref.Peername != got.Peername { return fmt.Errorf("Given datasetRef %s does not match datasetRef on file: %s", ref.String(), got.String()) }