// FetchContainerIDMapping This function assumes it should find only one file inside the container
// ID directory. If there are several files, we could not determine which
// file name corresponds to the sandbox ID associated, and this would throw
// an error.
FetchContainerIDMapping This function assumes it should find only one file inside the container
ID directory. If there are several files, we could not determine which
file name corresponds to the sandbox ID associated, and this would throw
an error.
// FetchContainerIDMapping This function assumes it should find only one file inside the container // ID directory . If there are several files we could not determine which // file name corresponds to the sandbox ID associated and this would throw // an error .
func FetchContainerIDMapping(containerID string) (string, error) {
	if containerID == "" {
		return "", fmt.Errorf("Missing container ID")
	}
	if doUpdatePath() {
		SetCtrsMapTreePath(filepath.Join(rootless.GetRootlessDir(), ctrsMapTreePath))
	}
	dirPath := filepath.Join(ctrsMapTreePath, containerID)
	files, err := ioutil.ReadDir(dirPath)
	if err != nil {
		if os.IsNotExist(err) {
			return "", nil
		}
		return "", err
	}
	if len(files) != 1 {
		return "", fmt.Errorf("Too many files (%d) in %q", len(files), dirPath)
	}
	return files[0].Name(), nil
}
func FetchContainerIDMapping ( containerID string ) ( string , error ) { if containerID == " " { return " " , fmt . Errorf ( " " ) } if doUpdatePath ( ) { SetCtrsMapTreePath ( filepath . Join ( rootless . GetRootlessDir ( ) , ctrsMapTreePath ) ) } dirPath := filepath . Join ( ctrsMapTreePath , containerID ) files , err := ioutil . ReadDir ( dirPath ) if err != nil { if os . IsNotExist ( err ) { return " " , nil } return " " , err } if len ( files ) != 1 { return " " , fmt . Errorf ( " " , len ( files ) , dirPath ) } return files [ 0 ] . Name ( ) , nil }
FetchContainerIDMapping This function assumes it should find only one file inside the container
ID directory.
FetchContainerIDMapping This function assumes it should find only one file inside the container ID directory .