refactor(stack): change stack creation flow to save stack first [BE-12650] (#1959)
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"time"
|
||||
|
||||
portainer "github.com/portainer/portainer/api"
|
||||
httperror "github.com/portainer/portainer/pkg/libhttp/error"
|
||||
)
|
||||
|
||||
type UrlMethodStackBuildProcess interface {
|
||||
@@ -15,11 +14,12 @@ type UrlMethodStackBuildProcess interface {
|
||||
// Deploy stack based on the configuration
|
||||
Deploy(payload *StackPayload, endpoint *portainer.Endpoint) UrlMethodStackBuildProcess
|
||||
// Save the stack information to database
|
||||
SaveStack() (*portainer.Stack, *httperror.HandlerError)
|
||||
SaveStack() (*portainer.Stack, error)
|
||||
// Get reponse from http request. Use if it is needed
|
||||
GetResponse() string
|
||||
// Set manifest url
|
||||
SetURL(payload *StackPayload) UrlMethodStackBuildProcess
|
||||
Error() error
|
||||
}
|
||||
|
||||
type UrlMethodStackBuilder struct {
|
||||
@@ -55,7 +55,7 @@ func (b *UrlMethodStackBuilder) Deploy(payload *StackPayload, endpoint *portaine
|
||||
// Deploy the stack
|
||||
err := b.deploymentConfiger.Deploy()
|
||||
if err != nil {
|
||||
b.err = httperror.InternalServerError(err.Error(), err)
|
||||
b.err = err
|
||||
return b
|
||||
}
|
||||
|
||||
@@ -65,3 +65,7 @@ func (b *UrlMethodStackBuilder) Deploy(payload *StackPayload, endpoint *portaine
|
||||
func (b *UrlMethodStackBuilder) GetResponse() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (b *UrlMethodStackBuilder) Error() error {
|
||||
return b.err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user