Skip to content

Commit

Permalink
Make new workunit backward compatible (#1232)
Browse files Browse the repository at this point in the history
  • Loading branch information
matoval authored Dec 2, 2024
1 parent aa2756f commit 037c78f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/workceptor/remote_work.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
3 changes: 2 additions & 1 deletion pkg/workceptor/workceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"os"
"path"
"reflect"
"regexp"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 037c78f

Please sign in to comment.