From 5de8e7b256483da49b5b26bffccce43902ede011 Mon Sep 17 00:00:00 2001 From: shreddedbacon Date: Thu, 2 May 2024 11:14:52 +1000 Subject: [PATCH] chore: minor formatting fixes --- controllers/v1beta1/podmonitor_buildhandlers.go | 14 +++++++------- controllers/v1beta1/podmonitor_taskhandlers.go | 14 +++++++------- controllers/v1beta2/podmonitor_buildhandlers.go | 14 +++++++------- controllers/v1beta2/podmonitor_taskhandlers.go | 14 +++++++------- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/controllers/v1beta1/podmonitor_buildhandlers.go b/controllers/v1beta1/podmonitor_buildhandlers.go index 44686516..a75c227c 100644 --- a/controllers/v1beta1/podmonitor_buildhandlers.go +++ b/controllers/v1beta1/podmonitor_buildhandlers.go @@ -201,7 +201,7 @@ Logs on pod %s, assigned to cluster %s } msgBytes, err := json.Marshal(msg) if err != nil { - opLog.Error(err, "Unable to encode message as JSON") + opLog.Error(err, "unable to encode message as JSON") } if err := r.Messaging.Publish("lagoon-logs", msgBytes); err != nil { // if we can't publish the message, set it as a pending message @@ -334,7 +334,7 @@ func (r *LagoonMonitorReconciler) updateDeploymentAndEnvironmentTask( } msgBytes, err := json.Marshal(msg) if err != nil { - opLog.Error(err, "Unable to encode message as JSON") + opLog.Error(err, "unable to encode message as JSON") } if err := r.Messaging.Publish("lagoon-tasks:controller", msgBytes); err != nil { // if we can't publish the message, set it as a pending message @@ -429,7 +429,7 @@ func (r *LagoonMonitorReconciler) buildStatusLogsToLagoonLogs( ) msgBytes, err := json.Marshal(msg) if err != nil { - opLog.Error(err, "Unable to encode message as JSON") + opLog.Error(err, "unable to encode message as JSON") } if err := r.Messaging.Publish("lagoon-logs", msgBytes); err != nil { // if we can't publish the message, set it as a pending message @@ -568,16 +568,16 @@ Build %s // do any message publishing here, and update any pending messages if needed if err = r.buildStatusLogsToLagoonLogs(opLog, &lagoonBuild, &jobPod, &lagoonEnv, namespace, buildCondition.ToLower()); err != nil { - opLog.Error(err, fmt.Sprintf("Unable to publish build status logs")) + opLog.Error(err, "unable to publish build status logs") } if err = r.updateDeploymentAndEnvironmentTask(opLog, &lagoonBuild, &jobPod, &lagoonEnv, namespace, buildCondition.ToLower()); err != nil { - opLog.Error(err, fmt.Sprintf("Unable to publish build update")) + opLog.Error(err, "unable to publish build update") } // if the container logs can't be retrieved, we don't want to send any build logs back, as this will nuke // any previously received logs if !strings.Contains(string(allContainerLogs), "unable to retrieve container logs for containerd") { if err = r.buildLogsToLagoonLogs(opLog, &lagoonBuild, &jobPod, namespace, buildCondition.ToLower(), allContainerLogs); err != nil { - opLog.Error(err, fmt.Sprintf("Unable to publish build logs")) + opLog.Error(err, "unable to publish build logs") } } mergePatch, _ := json.Marshal(mergeMap) @@ -585,7 +585,7 @@ Build %s if err := r.Get(ctx, req.NamespacedName, &lagoonBuild); err == nil { // if it does, try to patch it if err := r.Patch(ctx, &lagoonBuild, client.RawPatch(types.MergePatchType, mergePatch)); err != nil { - opLog.Error(err, "Unable to update resource") + opLog.Error(err, "unable to update resource") } } // just delete the pod diff --git a/controllers/v1beta1/podmonitor_taskhandlers.go b/controllers/v1beta1/podmonitor_taskhandlers.go index 7eadd880..af03a7c3 100644 --- a/controllers/v1beta1/podmonitor_taskhandlers.go +++ b/controllers/v1beta1/podmonitor_taskhandlers.go @@ -141,7 +141,7 @@ Logs on pod %s, assigned to cluster %s } msgBytes, err := json.Marshal(msg) if err != nil { - opLog.Error(err, "Unable to encode message as JSON") + opLog.Error(err, "unable to encode message as JSON") } if err := r.Messaging.Publish("lagoon-logs", msgBytes); err != nil { // if we can't publish the message, set it as a pending message @@ -200,7 +200,7 @@ func (r *LagoonMonitorReconciler) updateLagoonTask(opLog logr.Logger, } msgBytes, err := json.Marshal(msg) if err != nil { - opLog.Error(err, "Unable to encode message as JSON") + opLog.Error(err, "unable to encode message as JSON") } if err := r.Messaging.Publish("lagoon-tasks:controller", msgBytes); err != nil { // if we can't publish the message, set it as a pending message @@ -246,7 +246,7 @@ func (r *LagoonMonitorReconciler) taskStatusLogsToLagoonLogs(opLog logr.Logger, } msgBytes, err := json.Marshal(msg) if err != nil { - opLog.Error(err, "Unable to encode message as JSON") + opLog.Error(err, "unable to encode message as JSON") } if err := r.Messaging.Publish("lagoon-logs", msgBytes); err != nil { // if we can't publish the message, set it as a pending message @@ -344,16 +344,16 @@ Task %s // send any messages to lagoon message queues // update the deployment with the status if err = r.taskStatusLogsToLagoonLogs(opLog, &lagoonTask, &jobPod, taskCondition.ToLower()); err != nil { - opLog.Error(err, fmt.Sprintf("Unable to publish task status logs")) + opLog.Error(err, "unable to publish task status logs") } if err = r.updateLagoonTask(opLog, &lagoonTask, &jobPod, taskCondition.ToLower()); err != nil { - opLog.Error(err, fmt.Sprintf("Unable to publish task update")) + opLog.Error(err, "unable to publish task update") } // if the container logs can't be retrieved, we don't want to send any task logs back, as this will nuke // any previously received logs if !strings.Contains(string(allContainerLogs), "unable to retrieve container logs for containerd") { if err = r.taskLogsToLagoonLogs(opLog, &lagoonTask, &jobPod, taskCondition.ToLower(), allContainerLogs); err != nil { - opLog.Error(err, fmt.Sprintf("Unable to publish task logs")) + opLog.Error(err, "unable to publish task logs") } } mergePatch, _ := json.Marshal(mergeMap) @@ -361,7 +361,7 @@ Task %s if err := r.Get(ctx, req.NamespacedName, &lagoonTask); err == nil { // if it does, try to patch it if err := r.Patch(ctx, &lagoonTask, client.RawPatch(types.MergePatchType, mergePatch)); err != nil { - opLog.Error(err, "Unable to update resource") + opLog.Error(err, "unable to update resource") } } // just delete the pod diff --git a/controllers/v1beta2/podmonitor_buildhandlers.go b/controllers/v1beta2/podmonitor_buildhandlers.go index b0b3144f..b79a0bd6 100644 --- a/controllers/v1beta2/podmonitor_buildhandlers.go +++ b/controllers/v1beta2/podmonitor_buildhandlers.go @@ -202,7 +202,7 @@ Logs on pod %s, assigned to cluster %s } msgBytes, err := json.Marshal(msg) if err != nil { - opLog.Error(err, "Unable to encode message as JSON") + opLog.Error(err, "unable to encode message as JSON") } if err := r.Messaging.Publish("lagoon-logs", msgBytes); err != nil { // if we can't publish the message, set it as a pending message @@ -340,7 +340,7 @@ func (r *LagoonMonitorReconciler) updateDeploymentAndEnvironmentTask( } msgBytes, err := json.Marshal(msg) if err != nil { - opLog.Error(err, "Unable to encode message as JSON") + opLog.Error(err, "unable to encode message as JSON") } if err := r.Messaging.Publish("lagoon-tasks:controller", msgBytes); err != nil { // if we can't publish the message, set it as a pending message @@ -434,7 +434,7 @@ func (r *LagoonMonitorReconciler) buildStatusLogsToLagoonLogs( ) msgBytes, err := json.Marshal(msg) if err != nil { - opLog.Error(err, "Unable to encode message as JSON") + opLog.Error(err, "unable to encode message as JSON") } if err := r.Messaging.Publish("lagoon-logs", msgBytes); err != nil { // if we can't publish the message, set it as a pending message @@ -574,16 +574,16 @@ Build %s // do any message publishing here, and update any pending messages if needed if err = r.buildStatusLogsToLagoonLogs(opLog, &lagoonBuild, &jobPod, &lagoonEnv, namespace, buildCondition.ToLower()); err != nil { - opLog.Error(err, fmt.Sprintf("Unable to publish build status logs")) + opLog.Error(err, "unable to publish build status logs") } if err = r.updateDeploymentAndEnvironmentTask(opLog, &lagoonBuild, &jobPod, &lagoonEnv, namespace, buildCondition.ToLower()); err != nil { - opLog.Error(err, fmt.Sprintf("Unable to publish build update")) + opLog.Error(err, "unable to publish build update") } // if the container logs can't be retrieved, we don't want to send any build logs back, as this will nuke // any previously received logs if !strings.Contains(string(allContainerLogs), "unable to retrieve container logs for containerd") { if err = r.buildLogsToLagoonLogs(opLog, &lagoonBuild, &jobPod, namespace, buildCondition.ToLower(), allContainerLogs); err != nil { - opLog.Error(err, fmt.Sprintf("Unable to publish build logs")) + opLog.Error(err, "unable to publish build logs") } } mergePatch, _ := json.Marshal(mergeMap) @@ -591,7 +591,7 @@ Build %s if err := r.Get(ctx, req.NamespacedName, &lagoonBuild); err == nil { // if it does, try to patch it if err := r.Patch(ctx, &lagoonBuild, client.RawPatch(types.MergePatchType, mergePatch)); err != nil { - opLog.Error(err, "Unable to update resource") + opLog.Error(err, "unable to update resource") } } // just delete the pod diff --git a/controllers/v1beta2/podmonitor_taskhandlers.go b/controllers/v1beta2/podmonitor_taskhandlers.go index ebada680..53dd39e4 100644 --- a/controllers/v1beta2/podmonitor_taskhandlers.go +++ b/controllers/v1beta2/podmonitor_taskhandlers.go @@ -143,7 +143,7 @@ Logs on pod %s, assigned to cluster %s } msgBytes, err := json.Marshal(msg) if err != nil { - opLog.Error(err, "Unable to encode message as JSON") + opLog.Error(err, "unable to encode message as JSON") } if err := r.Messaging.Publish("lagoon-logs", msgBytes); err != nil { // if we can't publish the message, set it as a pending message @@ -208,7 +208,7 @@ func (r *LagoonMonitorReconciler) updateLagoonTask(opLog logr.Logger, } msgBytes, err := json.Marshal(msg) if err != nil { - opLog.Error(err, "Unable to encode message as JSON") + opLog.Error(err, "unable to encode message as JSON") } if err := r.Messaging.Publish("lagoon-tasks:controller", msgBytes); err != nil { // if we can't publish the message, set it as a pending message @@ -254,7 +254,7 @@ func (r *LagoonMonitorReconciler) taskStatusLogsToLagoonLogs(opLog logr.Logger, } msgBytes, err := json.Marshal(msg) if err != nil { - opLog.Error(err, "Unable to encode message as JSON") + opLog.Error(err, "unable to encode message as JSON") } if err := r.Messaging.Publish("lagoon-logs", msgBytes); err != nil { // if we can't publish the message, set it as a pending message @@ -353,16 +353,16 @@ Task %s // send any messages to lagoon message queues // update the deployment with the status if err = r.taskStatusLogsToLagoonLogs(opLog, &lagoonTask, &jobPod, taskCondition.ToLower()); err != nil { - opLog.Error(err, fmt.Sprintf("Unable to publish task status logs")) + opLog.Error(err, "unable to publish task status logs") } if err = r.updateLagoonTask(opLog, &lagoonTask, &jobPod, taskCondition.ToLower()); err != nil { - opLog.Error(err, fmt.Sprintf("Unable to publish task update")) + opLog.Error(err, "unable to publish task update") } // if the container logs can't be retrieved, we don't want to send any task logs back, as this will nuke // any previously received logs if !strings.Contains(string(allContainerLogs), "unable to retrieve container logs for containerd") { if err = r.taskLogsToLagoonLogs(opLog, &lagoonTask, &jobPod, taskCondition.ToLower(), allContainerLogs); err != nil { - opLog.Error(err, fmt.Sprintf("Unable to publish task logs")) + opLog.Error(err, "unable to publish task logs") } } mergePatch, _ := json.Marshal(mergeMap) @@ -370,7 +370,7 @@ Task %s if err := r.Get(ctx, req.NamespacedName, &lagoonTask); err == nil { // if it does, try to patch it if err := r.Patch(ctx, &lagoonTask, client.RawPatch(types.MergePatchType, mergePatch)); err != nil { - opLog.Error(err, "Unable to update resource") + opLog.Error(err, "unable to update resource") } } // just delete the pod