improve disk change detection
Some checks are pending
CI / Lint (push) Waiting to run
CI / Test (push) Waiting to run
CI / End-to-End (push) Waiting to run
CI / Publish Docker (push) Blocked by required conditions
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-09-27 13:58:33 +10:00
parent a7dc838c83
commit 5a00f4a8c7
3 changed files with 4 additions and 3 deletions

View File

@@ -97,7 +97,8 @@ func (h *Handler) VmModifyEvent(w http.ResponseWriter, r *http.Request) {
// Check if a disk was added (or maybe removed?)
if strings.Contains(change["type"], "config.hardware.device") &&
strings.Contains(event.CloudEvent.Data.FullFormattedMessage, ".vmdk") {
(strings.Contains(event.CloudEvent.Data.FullFormattedMessage, ".vmdk") ||
strings.Contains(event.CloudEvent.Data.FullFormattedMessage, "capacityInKB")) {
// TODO - query current disk size from Inventory table and only create an update if the size is now changed
if testConfig.DeviceChange != nil {

View File

@@ -24,6 +24,7 @@ func NewLoggingMiddleware(logger *slog.Logger, handler http.Handler) *LoggingMid
func (l *LoggingMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request) {
start := time.Now()
l.handler.ServeHTTP(w, r)
l.logger.Debug(
"Request recieved",
slog.String("method", r.Method),

View File

@@ -3,7 +3,6 @@ package server
import (
"context"
"crypto/tls"
"fmt"
"log/slog"
"net/http"
"os"
@@ -99,7 +98,7 @@ func SetTls(disableTls bool) Option {
// SetCertificate sets the path to the certificate used for TLS, in PEM format
func SetCertificate(tlsCertFilename string) Option {
return func(s *Server) {
fmt.Printf("Setting tlsCertFilename to '%s'\n", tlsCertFilename)
//fmt.Printf("Setting tlsCertFilename to '%s'\n", tlsCertFilename)
s.tlsCertFilename = tlsCertFilename
}
}