From 3b0206b1e99e07392eba892aeb78cab919b04f9f Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Thu, 26 Sep 2024 15:16:56 +1000 Subject: [PATCH] improve regex for config changes --- server/handler/vmModifyEvent.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/handler/vmModifyEvent.go b/server/handler/vmModifyEvent.go index 234563f..e98ac46 100644 --- a/server/handler/vmModifyEvent.go +++ b/server/handler/vmModifyEvent.go @@ -196,7 +196,8 @@ func (h *Handler) processConfigChanges(configChanges string) []map[string]string // "config.memoryHotAddEnabled: true -\u003e false; \n\nconfig.cpuHotAddEnabled: true -\u003e false; \n\n" // "config.hardware.device(1000).device: (2000, 2001, 2002) -> (2000, 2001, 2002, 2003);" // "config.hardware.numCPU: 2 -\u003e 1; \n\nconfig.hardware.memoryMB: 4096 -\u003e 3072;" - re := regexp.MustCompile(`(?P[^\s]+): [^-]+-[><] (?P[^;]+);`) + //re := regexp.MustCompile(`(?P[^\s]+): [^-]+-[><] (?P[^;]+);`) + re := regexp.MustCompile(`(?P[^\s]+): .*?+-[><] (?P[^;]+);`) // Result will hold a list of changes with type and new value var result []map[string]string