findUser looks up a user by name or ID.
(nameOrID string)
| 1401 | |
| 1402 | // findUser looks up a user by name or ID. |
| 1403 | func findUser(nameOrID string) (*user.User, error) { |
| 1404 | if nameOrID == "" { |
| 1405 | return &user.User{ |
| 1406 | Uid: "0", |
| 1407 | Gid: "0", |
| 1408 | }, nil |
| 1409 | } |
| 1410 | _, err := strconv.Atoi(nameOrID) |
| 1411 | if err == nil { |
| 1412 | return user.LookupId(nameOrID) |
| 1413 | } |
| 1414 | return user.Lookup(nameOrID) |
| 1415 | } |
| 1416 | |
| 1417 | func execOneLifecycleScript( |
| 1418 | ctx context.Context, |