MCPcopy Create free account
hub / github.com/Mirantis/cri-dockerd / getUserFromImageUser

Function getUserFromImageUser

core/image.go:253–267  ·  view source on GitHub ↗

getUserFromImageUser gets uid or user name of the image user. If user is numeric, it will be treated as uid; or else, it is treated as user name.

(imageUser string)

Source from the content-addressed store, hash-verified

251// getUserFromImageUser gets uid or user name of the image user.
252// If user is numeric, it will be treated as uid; or else, it is treated as user name.
253func getUserFromImageUser(imageUser string) (*int64, string) {
254 user := parseUserFromImageUser(imageUser)
255 // return both nil if user is not specified in the image.
256 if user == "" {
257 return nil, ""
258 }
259 // user could be either uid or user name. Try to interpret as numeric uid.
260 uid, err := strconv.ParseInt(user, 10, 64)
261 if err != nil {
262 // If user is non numeric, assume it's user name.
263 return nil, user
264 }
265 // If user is a numeric uid.
266 return &uid, ""
267}

Callers 2

TestGetUserFromImageUserFunction · 0.85

Calls 1

parseUserFromImageUserFunction · 0.85

Tested by 1

TestGetUserFromImageUserFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…