Skip to content

Commit bdf44c9

Browse files
authored
Merge pull request #322 from doringeman/render-group
fix(standalone): make render group addition non-fatal
2 parents 1c872eb + 0cbbba8 commit bdf44c9

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

cmd/cli/pkg/standalone/containers.go

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -334,14 +334,21 @@ func CreateControllerContainer(ctx context.Context, dockerClient *client.Client,
334334
if runtime.GOOS == "linux" {
335335
out, err := exec.CommandContext(ctx, "getent", "group", "render").CombinedOutput()
336336
if err != nil {
337-
return fmt.Errorf("failed to retrieve the GID of 'render': %w", err)
338-
}
339-
tokens := strings.Split(string(out), ":")
340-
gid, err := strconv.Atoi(tokens[2])
341-
if err != nil {
342-
return fmt.Errorf("failed to parse the GID of 'render': %w", err)
337+
printer.Printf("Warning: render group not found, skipping group addition\n")
338+
} else {
339+
trimmedOut := strings.TrimSpace(string(out))
340+
tokens := strings.Split(trimmedOut, ":")
341+
if len(tokens) < 3 {
342+
printer.Printf("Warning: unexpected getent output format: %q\n", trimmedOut)
343+
} else {
344+
gid, err := strconv.Atoi(tokens[2])
345+
if err != nil {
346+
printer.Printf("Warning: failed to parse render GID from %q: %v\n", tokens[2], err)
347+
} else {
348+
hostConfig.GroupAdd = append(hostConfig.GroupAdd, strconv.Itoa(gid))
349+
}
350+
}
343351
}
344-
hostConfig.GroupAdd = append(hostConfig.GroupAdd, strconv.Itoa(gid))
345352
}
346353

347354
// Create the container. If we detect that a concurrent installation is in

0 commit comments

Comments
 (0)