MCPcopy Create free account
hub / github.com/celer-pkg/celer / ensureGroupIDUnused

Function ensureGroupIDUnused

pkgcache/cache_setup.go:492–508  ·  view source on GitHub ↗
(requiredGID, allowedGroupName string)

Source from the content-addressed store, hash-verified

490}
491
492func ensureGroupIDUnused(requiredGID, allowedGroupName string) error {
493 existingGroup, err := lookupGroupID(requiredGID)
494 if err != nil {
495 var unknownGroupIDError user.UnknownGroupIdError
496 var unknownGroupError user.UnknownGroupError
497 if !errors.As(err, &unknownGroupIDError) && !errors.As(err, &unknownGroupError) {
498 return fmt.Errorf("failed to lookup group id %s -> %w", requiredGID, err)
499 }
500 return nil
501 }
502
503 if existingGroup.Name == allowedGroupName {
504 return nil
505 }
506
507 return fmt.Errorf("gid %s is already used by local group %q", requiredGID, existingGroup.Name)
508}
509
510func changeGroupGID(groupName, oldGID, requiredGID string) error {
511 if err := ensureGroupIDUnused(requiredGID, groupName); err != nil {

Callers 2

createSystemGroupAndUserFunction · 0.85
changeGroupGIDFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected