From a65a7603d26e48b0031a3fbf68c057ba26bed9be Mon Sep 17 00:00:00 2001 From: matoval Date: Mon, 2 Dec 2024 09:27:37 -0800 Subject: [PATCH] make new workunit backward compatible --- pkg/workceptor/remote_work.go | 2 +- pkg/workceptor/workceptor.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/workceptor/remote_work.go b/pkg/workceptor/remote_work.go index b29a8cbc5..7aec7773b 100644 --- a/pkg/workceptor/remote_work.go +++ b/pkg/workceptor/remote_work.go @@ -184,7 +184,7 @@ func (rw *remoteUnit) startRemoteUnit(ctx context.Context, conn net.Conn, reader if err != nil { return fmt.Errorf("read error reading from %s: %s", red.RemoteNode, err) } - submitIDRegex := regexp.MustCompile(`with ID ([.\-_@a-zA-Z0-9]+)\.`) + submitIDRegex := regexp.MustCompile(`with ID ([a-zA-Z0-9]+)\.`) match := submitIDRegex.FindSubmatch([]byte(response)) if match == nil || len(match) != 2 { return fmt.Errorf("could not parse response: %s", strings.TrimRight(response, "\n")) diff --git a/pkg/workceptor/workceptor.go b/pkg/workceptor/workceptor.go index 674ecfc99..199867466 100644 --- a/pkg/workceptor/workceptor.go +++ b/pkg/workceptor/workceptor.go @@ -13,6 +13,7 @@ import ( "os" "path" "reflect" + "regexp" "strings" "sync" "time" @@ -162,7 +163,7 @@ func (w *Workceptor) generateUnitID(lock bool, workUnitID string) (string, error for { if workUnitID == "" { rstr := randstr.RandomString(8) - nid := w.nc.NodeID() + nid := regexp.MustCompile(`[^a-zA-Z0-9 ]+`).ReplaceAllString(w.nc.NodeID(), "") ident = fmt.Sprintf("%s%s", nid, rstr) } else { ident = workUnitID