Fix handlers
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Adam Štrauch 2022-02-03 01:41:00 +01:00
parent 27754caaf0
commit caf791548d
Signed by: cx
GPG Key ID: 018304FFA8988F8D
1 changed files with 8 additions and 2 deletions

View File

@ -616,7 +616,13 @@ func processesEventHandler(m *nats.Msg, message *RequestMessage) error {
// If payload contains only name of the tech the default version for given image is selected.
// Otherwise it can be passed in format tech:version.
func enableTechEventHandler(m *nats.Msg, message *RequestMessage) error {
if !regexp.Match("[a-z0-9A-Z]*:?[0-9\.\-]*", []byte(message.Payload)) {
matched, err := regexp.Match(`[a-z0-9A-Z]*:?[0-9\.\-]*`, []byte(message.Payload))
if err != nil {
log.Println("ERROR enable tech problem: " + err.Error())
publish(message.AppName, "backend problem", true)
return err
}
if !matched {
return errors.New("payload malformation, it has to be in format tech:version")
}
@ -633,7 +639,7 @@ func enableTechEventHandler(m *nats.Msg, message *RequestMessage) error {
version = parts[1]
}
err := waitForApp(message.AppName)
err = waitForApp(message.AppName)
if err != nil {
log.Println("ERROR enable tech problem: " + err.Error())
publish(message.AppName, "backend problem", true)