blueprints: Fix commit message when version is empty
With an empty or missing version number the commit message would not include the version (which is set to 0.0.0 by calling Initialize). This adds a call to Initialize() in the API code before constructing the commit message. It also moves the check for non-empty blueprint name into the Initialize call where it belongs.
This commit is contained in:
parent
8fcbeaadb3
commit
d42d5fa17f
3 changed files with 18 additions and 7 deletions
|
|
@ -1945,6 +1945,17 @@ func (api *API) blueprintsNewHandler(writer http.ResponseWriter, request *http.R
|
|||
}
|
||||
}
|
||||
|
||||
// Make sure the blueprint has default values and that the version is valid
|
||||
err = blueprint.Initialize()
|
||||
if err != nil {
|
||||
errors := responseError{
|
||||
ID: "BlueprintsError",
|
||||
Msg: err.Error(),
|
||||
}
|
||||
statusResponseError(writer, http.StatusBadRequest, errors)
|
||||
return
|
||||
}
|
||||
|
||||
commitMsg := "Recipe " + blueprint.Name + ", version " + blueprint.Version + " saved."
|
||||
err = api.store.PushBlueprint(blueprint, commitMsg)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue