if (tezJarUris.length == 1 && (tezJarUris[0].endsWith(".tar.gz") || tezJarUris[0].endsWith(".tgz"))) {
String fileName = tezJarUris[0];
if (fileName.endsWith(".tar.gz") || fileName.endsWith(".tgz")) {
FileStatus fStatus = getLRFileStatus(fileName, conf, false)[0];
LocalResourceVisibility lrVisibility;
if (checkAncestorPermissionsForAllUsers(conf, fileName, FsAction.EXECUTE) &&
fStatus.getPermission().getOtherAction().implies(FsAction.READ)) {
lrVisibility = LocalResourceVisibility.PUBLIC;
} else {
lrVisibility = LocalResourceVisibility.PRIVATE;
}
tezJarResources.put(TezConstants.TEZ_TAR_LR_NAME,
LocalResource.newInstance(
ConverterUtils.getYarnUrlFromPath(fStatus.getPath()),
LocalResourceType.ARCHIVE,
lrVisibility,
fStatus.getLen(),
fStatus.getModificationTime()));
tezJarPaths.add(fStatus.getPath());
}
} else { // Treat as non-archives - each entry being a directory
for (String tezJarUri : tezJarUris) {
boolean ancestorsHavePermission = checkAncestorPermissionsForAllUsers(conf, tezJarUri,
FsAction.EXECUTE);
FileStatus [] fileStatuses = getLRFileStatus(tezJarUri, conf, true);
for (FileStatus fStatus : fileStatuses) {
if (fStatus.isDirectory()) {
// Skip directories - since tez.lib.uris is not recursive.
continue;
}
LocalResourceVisibility lrVisibility;
if (ancestorsHavePermission &&
fStatus.getPermission().getOtherAction().implies(FsAction.READ)) {
lrVisibility = LocalResourceVisibility.PUBLIC;
} else {
lrVisibility = LocalResourceVisibility.PRIVATE;