diff --git a/internal/messenger/consumer.go b/internal/messenger/consumer.go index 49ed3210..a0b90853 100644 --- a/internal/messenger/consumer.go +++ b/internal/messenger/consumer.go @@ -365,6 +365,13 @@ func (m *Messenger) Consumer(targetName string) { //error { ) err := m.IngressRouteMigration(namespace, jobSpec) if err != nil { + opLog.Error(err, + fmt.Sprintf( + "Route migration / activestandby switch for project %s, environment %s failed to be created", + jobSpec.Project.Name, + jobSpec.Environment.Name, + ), + ) //@TODO: send msg back to lagoon and update task to failed? message.Ack(false) // ack to remove from queue return @@ -378,6 +385,13 @@ func (m *Messenger) Consumer(targetName string) { //error { ) err := m.AdvancedTask(namespace, jobSpec) if err != nil { + opLog.Error(err, + fmt.Sprintf( + "Advanced task for project %s, environment %s failed to be created", + jobSpec.Project.Name, + jobSpec.Environment.Name, + ), + ) //@TODO: send msg back to lagoon and update task to failed? message.Ack(false) // ack to remove from queue return @@ -391,6 +405,13 @@ func (m *Messenger) Consumer(targetName string) { //error { ) err := m.ActiveStandbySwitch(namespace, jobSpec) if err != nil { + opLog.Error(err, + fmt.Sprintf( + "Active/Standby switch for project %s, environment %s failed to be created", + jobSpec.Project.Name, + jobSpec.Environment.Name, + ), + ) //@TODO: send msg back to lagoon and update task to failed? message.Ack(false) // ack to remove from queue return diff --git a/internal/messenger/tasks_handler.go b/internal/messenger/tasks_handler.go index ded60952..a5ff074a 100644 --- a/internal/messenger/tasks_handler.go +++ b/internal/messenger/tasks_handler.go @@ -2,6 +2,7 @@ package messenger import ( "context" + "encoding/base64" "encoding/json" "fmt" "sort" @@ -251,7 +252,11 @@ func (m *Messenger) ActiveStandbySwitch(namespace string, jobSpec *lagoonv1beta1 jobSpec.AdvancedTask.DeployerToken = true jobSpec.AdvancedTask.SSHKey = true asPayload := &ActiveStandbyPayload{} - err := json.Unmarshal([]byte(jobSpec.AdvancedTask.JSONPayload), asPayload) + asPayloadDecoded, err := base64.StdEncoding.DecodeString(jobSpec.AdvancedTask.JSONPayload) + if err != nil { + return fmt.Errorf("Unable to base64 decode payload: %v", err) + } + err = json.Unmarshal([]byte(asPayloadDecoded), asPayload) if err != nil { return fmt.Errorf("Unable to unmarshal json payload: %v", err) }