本文整理了Java中hudson.FilePath.chmod()
方法的一些代码示例,展示了FilePath.chmod()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FilePath.chmod()
方法的具体详情如下:
包路径:hudson.FilePath
类名称:FilePath
方法名:chmod
[英]Sets the file permission. On Windows, no-op.
[中]设置文件权限。在Windows上,无操作。
代码示例来源:origin: jenkinsci/jenkins
@VisibleForTesting
void save() throws IOException, InterruptedException {
try (OutputStream os = store.write()) {
props.store(os, "Credential store");
}
// try to protect this file from other users, if we can.
store.chmod(0600);
}
代码示例来源:origin: jenkinsci/jenkins
public DefaultConfidentialStore(File rootDir) throws IOException, InterruptedException {
this.rootDir = rootDir;
if (rootDir.mkdirs()) {
// protect this directory. but don't change the permission of the existing directory
// in case the administrator changed this.
new FilePath(rootDir).chmod(0700);
}
TextFile masterSecret = new TextFile(new File(rootDir,"master.key"));
if (!masterSecret.exists()) {
// we are only going to use small number of bits (since export control limits AES key length)
// but let's generate a long enough key anyway
masterSecret.write(Util.toHexString(randomBytes(128)));
}
this.masterKey = Util.toAes128Key(masterSecret.readTrim());
}
代码示例来源:origin: jenkinsci/jenkins
int mode = e.getUnixMode();
if (mode!=0) // Ant returns 0 if the archive doesn't record the access mode
target.chmod(mode);
} catch (InterruptedException ex) {
LOGGER.log(Level.WARNING, "unable to set permissions", ex);
代码示例来源:origin: jenkinsci/jenkins
/**
* Copies this file to the specified target, with file permissions and other meta attributes intact.
* @since 1.311
*/
public void copyToWithPermission(FilePath target) throws IOException, InterruptedException {
// Use NIO copy with StandardCopyOption.COPY_ATTRIBUTES when copying on the same machine.
if (this.channel == target.channel) {
act(new CopyToWithPermission(target));
return;
}
copyTo(target);
// copy file permission
target.chmod(mode());
target.setLastModifiedIfPossible(lastModified());
}
private class CopyToWithPermission extends SecureFileCallable<Void> {
代码示例来源:origin: jenkinsci/jenkins
iapf.chmod(0640);
iapf.write(randomUUID + System.lineSeparator(), "UTF-8");
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
@VisibleForTesting
void save() throws IOException, InterruptedException {
try (OutputStream os = store.write()) {
props.store(os, "Credential store");
}
// try to protect this file from other users, if we can.
store.chmod(0600);
}
}
代码示例来源:origin: org.jenkins-ci.modules/launchd-slave-installer
private File copyResourceIntoExecutableFile(String resourceName) throws IOException, InterruptedException {
File f = new File(tmpDir,resourceName);
FileUtils.copyURLToFile(getClass().getResource(resourceName), f);
new FilePath(f).chmod(0755);
return f;
}
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
public void chmod(String file, int mode) throws IOException, InterruptedException {
$(file).chmod(mode);
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
public void chmod(String file, int mode) throws IOException, InterruptedException {
$(file).chmod(mode);
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
@Override
public void chmod(String file, int mode) throws IOException, InterruptedException {
$(file).chmod(mode);
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* Copies this file to the specified target, with file permissions intact.
* @since 1.311
*/
public void copyToWithPermission(FilePath target) throws IOException, InterruptedException {
copyTo(target);
// copy file permission
target.chmod(mode());
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
/**
* Copies this file to the specified target, with file permissions intact.
* @since 1.311
*/
public void copyToWithPermission(FilePath target) throws IOException, InterruptedException {
copyTo(target);
// copy file permission
target.chmod(mode());
}
代码示例来源:origin: hudson/hudson-2.x
/**
* Copies this file to the specified target, with file permissions intact.
* @since 1.311
*/
public void copyToWithPermission(FilePath target) throws IOException, InterruptedException {
copyTo(target);
// copy file permission
target.chmod(mode());
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
/**
* Copies this file to the specified target, with file permissions intact.
*
* @since 1.311
*/
public void copyToWithPermission(FilePath target) throws IOException, InterruptedException {
copyTo(target);
// copy file permission
target.chmod(mode());
}
代码示例来源:origin: jenkinsci/docker-commons-plugin
/**
* Creates a read-protected directory inside {@link KeyMaterialContext#getBaseDir} suitable for storing secret files.
* Be sure to {@link FilePath#deleteRecursive} this in {@link KeyMaterial#close}.
*/
protected final FilePath createSecretsDirectory() throws IOException, InterruptedException {
FilePath dir = new FilePath(getContext().getBaseDir(), UUID.randomUUID().toString());
dir.mkdirs();
dir.chmod(0700);
return dir;
}
代码示例来源:origin: org.jenkins-ci.plugins/docker-commons
@Override
protected FilePath write(DockerServerCredentials credentials, FilePath dir) throws IOException, InterruptedException {
FilePath clientKey = dir.child("key.pem");
clientKey.write(credentials.getClientKey(), null);
clientKey.chmod(0600);
FilePath clientCert = dir.child("cert.pem");
clientCert.write(credentials.getClientCertificate(), null);
clientCert.chmod(0600);
FilePath serverCACert = dir.child("ca.pem");
serverCACert.write(credentials.getServerCaCertificate(), null);
serverCACert.chmod(0600);
return dir;
}
代码示例来源:origin: jenkinsci/debian-package-builder-plugin
private FilePath getRemoteKeyPath(AbstractBuild<?, ?> build, Runner runner) throws IOException, InterruptedException {
String keysDir = "debian-package-builder-keys";
String relativeKeyPath = new File(keysDir, getRepo(build, runner).getKeypath()).getPath();
File absoluteKeyPath = new File (Jenkins.getInstance().getRootDir(), relativeKeyPath);
FilePath localKey = new FilePath(absoluteKeyPath);
FilePath remoteKey = build.getWorkspace().createTextTempFile("private", "key", localKey.readToString());
remoteKey.chmod(0600);
return remoteKey;
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Copies this file to the specified target, with file permissions and other meta attributes intact.
* @since 1.311
*/
public void copyToWithPermission(FilePath target) throws IOException, InterruptedException {
copyTo(target);
// copy file permission
target.chmod(mode());
target.setLastModifiedIfPossible(lastModified());
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
public DefaultConfidentialStore(File rootDir) throws IOException, InterruptedException {
this.rootDir = rootDir;
if (rootDir.mkdirs()) {
// protect this directory. but don't change the permission of the existing directory
// in case the administrator changed this.
new FilePath(rootDir).chmod(0700);
}
TextFile masterSecret = new TextFile(new File(rootDir,"master.key"));
if (!masterSecret.exists()) {
// we are only going to use small number of bits (since export control limits AES key length)
// but let's generate a long enough key anyway
masterSecret.write(Util.toHexString(randomBytes(128)));
}
this.masterKey = Util.toAes128Key(masterSecret.readTrim());
}
代码示例来源:origin: jenkinsci/android-emulator-plugin
/**
* Recursively flags anything that looks like an Android tools executable, as executable.
*
* @param toolsDir The top level Android SDK tools directory.
*/
private static final void setPermissions(FilePath toolsDir) throws IOException, InterruptedException {
for (FilePath dir : toolsDir.listDirectories()) {
setPermissions(dir);
}
for (FilePath f : toolsDir.list(new ToolFileFilter())) {
f.chmod(0755);
}
}
内容来源于网络,如有侵权,请联系作者删除!