本文整理了Java中org.jclouds.scriptbuilder.domain.Statements.appendFile()
方法的一些代码示例,展示了Statements.appendFile()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Statements.appendFile()
方法的具体详情如下:
包路径:org.jclouds.scriptbuilder.domain.Statements
类名称:Statements
方法名:appendFile
暂无
代码示例来源:origin: io.brooklyn/brooklyn-locations-jclouds
public static Statement addAuthorizedKeysToRoot(String publicKey) {
return newStatementList(
appendFile("/root/.ssh/authorized_keys", Splitter.on('\n').split(publicKey)),
interpret("chmod 600 /root/.ssh/authorized_keys"));
}
代码示例来源:origin: jclouds/legacy-jclouds
@Override
public String render(OsFamily family) {
checkNotNull(family, "family");
if (family == OsFamily.WINDOWS)
throw new UnsupportedOperationException("windows not yet implemented");
Builder<Statement> statements = ImmutableList.builder();
statements.add(exec("mkdir -p " + sshDir));
String authorizedKeys = sshDir + "{fs}authorized_keys";
statements.add(appendFile(authorizedKeys, Splitter.on('\n').split(Joiner.on("\n\n").join(publicKeys))));
statements.add(exec("chmod 600 " + authorizedKeys));
return new StatementList(statements.build()).render(family);
}
}
代码示例来源:origin: org.jclouds/jclouds-scriptbuilder
@Override
public String render(OsFamily family) {
checkNotNull(family, "family");
if (family == OsFamily.WINDOWS)
throw new UnsupportedOperationException("windows not yet implemented");
Builder<Statement> statements = ImmutableList.builder();
statements.add(exec("mkdir -p " + sshDir));
String authorizedKeys = sshDir + "{fs}authorized_keys";
statements.add(appendFile(authorizedKeys, Splitter.on('\n').split(Joiner.on("\n\n").join(publicKeys))));
statements.add(exec("chmod 600 " + authorizedKeys));
return new StatementList(statements.build()).render(family);
}
}
代码示例来源:origin: jclouds/legacy-jclouds
private void addUnixRunScriptFooter(String runScript, StringBuilder builder) {
builder.append("# add runscript footer\n");
Iterable<String> endScript = Splitter.on(ShellToken.LF.to(OsFamily.UNIX)).split(
ShellToken.END_SCRIPT.to(OsFamily.UNIX));
builder.append(appendFile(runScript, endScript, DELIMITER).render(OsFamily.UNIX));
}
代码示例来源:origin: io.cloudsoft.jclouds/jclouds-scriptbuilder
@Override
public String render(OsFamily family) {
checkNotNull(family, "family");
if (family == OsFamily.WINDOWS)
throw new UnsupportedOperationException("windows not yet implemented");
Builder<Statement> statements = ImmutableList.builder();
statements.add(exec("mkdir -p " + sshDir));
String authorizedKeys = sshDir + "{fs}authorized_keys";
statements.add(appendFile(authorizedKeys, Splitter.on('\n').split(Joiner.on("\n\n").join(publicKeys))));
statements.add(exec("chmod 600 " + authorizedKeys));
return new StatementList(statements.build()).render(family);
}
}
代码示例来源:origin: io.cloudsoft.jclouds/jclouds-scriptbuilder
private void addUnixRunScriptFooter(String runScript, StringBuilder builder) {
builder.append("# add runscript footer\n");
Iterable<String> endScript = Splitter.on(ShellToken.LF.to(OsFamily.UNIX)).split(
ShellToken.END_SCRIPT.to(OsFamily.UNIX));
builder.append(appendFile(runScript, endScript, DELIMITER).render(OsFamily.UNIX));
}
代码示例来源:origin: com.amysta.jclouds/jclouds-scriptbuilder
private void addUnixRunScriptFooter(String runScript, StringBuilder builder) {
builder.append("# add runscript footer\n");
Iterable<String> endScript = Splitter.on(ShellToken.LF.to(OsFamily.UNIX)).split(
ShellToken.END_SCRIPT.to(OsFamily.UNIX));
builder.append(appendFile(runScript, endScript, DELIMITER).render(OsFamily.UNIX));
}
代码示例来源:origin: apache/jclouds
private void addUnixRunScriptFooter(String runScript, StringBuilder builder) {
builder.append("# add runscript footer\n");
Iterable<String> endScript = Splitter.on(ShellToken.LF.to(OsFamily.UNIX)).split(
ShellToken.END_SCRIPT.to(OsFamily.UNIX));
builder.append(appendFile(runScript, endScript, DELIMITER).render(OsFamily.UNIX));
}
代码示例来源:origin: org.jclouds/jclouds-scriptbuilder
private void addUnixRunScriptFooter(String runScript, StringBuilder builder) {
builder.append("# add runscript footer\n");
Iterable<String> endScript = Splitter.on(ShellToken.LF.to(OsFamily.UNIX)).split(
ShellToken.END_SCRIPT.to(OsFamily.UNIX));
builder.append(appendFile(runScript, endScript, DELIMITER).render(OsFamily.UNIX));
}
代码示例来源:origin: org.apache.jclouds/jclouds-scriptbuilder
private void addUnixRunScriptFooter(String runScript, StringBuilder builder) {
builder.append("# add runscript footer\n");
Iterable<String> endScript = Splitter.on(ShellToken.LF.to(OsFamily.UNIX)).split(
ShellToken.END_SCRIPT.to(OsFamily.UNIX));
builder.append(appendFile(runScript, endScript, DELIMITER).render(OsFamily.UNIX));
}
代码示例来源:origin: jclouds/legacy-jclouds
private void addUnixRunScript(String runScript, StringBuilder builder) {
builder.append("# add desired commands from the user\n");
Builder<String> userCommands = ImmutableList.builder();
userCommands.add("cd " + pwd);
for (Statement statement : statements) {
if (statement instanceof Call
|| (statement instanceof StatementList && any(StatementList.class.cast(statement).delegate(),
instanceOf(Call.class)))) {
statement = new ExitInsteadOfReturn(statement);
}
userCommands.addAll(Splitter.on('\n').split(statement.render(OsFamily.UNIX)));
}
builder.append(appendFile(runScript, userCommands.build(), DELIMITER).render(OsFamily.UNIX));
}
代码示例来源:origin: com.amysta.jclouds/jclouds-scriptbuilder
private void addUnixRunScript(String runScript, StringBuilder builder) {
builder.append("# add desired commands from the user\n");
Builder<String> userCommands = ImmutableList.builder();
userCommands.add("cd " + pwd);
for (Statement statement : statements) {
if (statement instanceof Call
|| (statement instanceof StatementList && any(StatementList.class.cast(statement).delegate(),
instanceOf(Call.class)))) {
statement = new ExitInsteadOfReturn(statement);
}
userCommands.addAll(Splitter.on('\n').split(statement.render(OsFamily.UNIX)));
}
builder.append(appendFile(runScript, userCommands.build(), DELIMITER).render(OsFamily.UNIX));
}
代码示例来源:origin: jclouds/legacy-jclouds
@Override
public String render(OsFamily family) {
checkNotNull(family, "family");
if (family == OsFamily.WINDOWS)
throw new UnsupportedOperationException("windows not yet implemented");
Builder<Statement> statements = ImmutableList.builder();
statements.add(exec("{md} " + sshDir));
String idRsa = sshDir + "{fs}id_rsa";
statements.add(exec("{rm} " + idRsa));
statements.add(appendFile(idRsa, Splitter.on('\n').split(privateKey)));
statements.add(exec("chmod 600 " + idRsa));
return new StatementList(statements.build()).render(family);
}
}
代码示例来源:origin: com.amysta.jclouds/jclouds-scriptbuilder
@Override
public String render(OsFamily family) {
checkNotNull(family, "family");
if (family == OsFamily.WINDOWS)
throw new UnsupportedOperationException("windows not yet implemented");
Builder<Statement> statements = ImmutableList.builder();
statements.add(exec("{md} " + sshDir));
String idRsa = sshDir + "{fs}id_rsa";
statements.add(exec("{rm} " + idRsa));
statements.add(appendFile(idRsa, Splitter.on('\n').split(privateKey)));
statements.add(exec("chmod 600 " + idRsa));
return new StatementList(statements.build()).render(family);
}
}
代码示例来源:origin: org.jclouds/jclouds-scriptbuilder
private void addUnixRunScript(String runScript, StringBuilder builder) {
builder.append("# add desired commands from the user\n");
Builder<String> userCommands = ImmutableList.builder();
userCommands.add("cd " + pwd);
for (Statement statement : statements) {
if (statement instanceof Call
|| (statement instanceof StatementList && any(StatementList.class.cast(statement).delegate(),
instanceOf(Call.class)))) {
statement = new ExitInsteadOfReturn(statement);
}
userCommands.addAll(Splitter.on('\n').split(statement.render(OsFamily.UNIX)));
}
builder.append(appendFile(runScript, userCommands.build(), DELIMITER).render(OsFamily.UNIX));
}
代码示例来源:origin: org.apache.jclouds/jclouds-scriptbuilder
@Override
public String render(OsFamily family) {
checkNotNull(family, "family");
if (family == OsFamily.WINDOWS)
throw new UnsupportedOperationException("windows not yet implemented");
Builder<Statement> statements = ImmutableList.builder();
statements.add(exec("{md} " + sshDir));
String idRsa = sshDir + "{fs}id_rsa";
statements.add(exec("{rm} " + idRsa));
statements.add(appendFile(idRsa, Splitter.on('\n').split(privateKey)));
statements.add(exec("chmod 600 " + idRsa));
return new StatementList(statements.build()).render(family);
}
}
代码示例来源:origin: io.cloudsoft.jclouds/jclouds-scriptbuilder
private void addUnixRunScript(String runScript, StringBuilder builder) {
builder.append("# add desired commands from the user\n");
Builder<String> userCommands = ImmutableList.builder();
userCommands.add("cd " + pwd);
for (Statement statement : statements) {
if (statement instanceof Call
|| (statement instanceof StatementList && any(StatementList.class.cast(statement).delegate(),
instanceOf(Call.class)))) {
statement = new ExitInsteadOfReturn(statement);
}
userCommands.addAll(Splitter.on('\n').split(statement.render(OsFamily.UNIX)));
}
builder.append(appendFile(runScript, userCommands.build(), DELIMITER).render(OsFamily.UNIX));
}
代码示例来源:origin: org.jclouds/jclouds-scriptbuilder
@Override
public String render(OsFamily family) {
checkNotNull(family, "family");
if (family == OsFamily.WINDOWS)
throw new UnsupportedOperationException("windows not yet implemented");
Builder<Statement> statements = ImmutableList.builder();
statements.add(exec("{md} " + sshDir));
String idRsa = sshDir + "{fs}id_rsa";
statements.add(exec("{rm} " + idRsa));
statements.add(appendFile(idRsa, Splitter.on('\n').split(privateKey)));
statements.add(exec("chmod 600 " + idRsa));
return new StatementList(statements.build()).render(family);
}
}
代码示例来源:origin: org.apache.jclouds/jclouds-scriptbuilder
private void addUnixRunScript(String runScript, StringBuilder builder) {
builder.append("# add desired commands from the user\n");
Builder<String> userCommands = ImmutableList.builder();
userCommands.add("cd " + pwd);
for (Statement statement : statements) {
if (statement instanceof Call
|| (statement instanceof StatementList && any(StatementList.class.cast(statement).delegate(),
instanceOf(Call.class)))) {
statement = new ExitInsteadOfReturn(statement);
}
userCommands.addAll(Splitter.on('\n').split(statement.render(OsFamily.UNIX)));
}
builder.append(appendFile(runScript, userCommands.build(), DELIMITER).render(OsFamily.UNIX));
}
代码示例来源:origin: jclouds/legacy-jclouds
public void testSwitchArgUNIX() {
assertEquals(new SwitchArg(1, ImmutableMap.of("0", newStatementList(appendFile(
"{tmp}{fs}{uid}{fs}scripttest{fs}temp.txt", ImmutableList.of("hello world")),
interpret("echo hello zero{lf}")), "1", interpret("echo hello one{lf}"))).render(OsFamily.UNIX),
"case $1 in\n"+
"0)\n"+
" cat >> /tmp/$USER/scripttest/temp.txt <<-'END_OF_JCLOUDS_FILE'\n"+
"\thello world\n"+
"END_OF_JCLOUDS_FILE\n"+
" echo hello zero\n"+
" ;;\n"+
"1)\n"+
" echo hello one\n"+
" ;;\n"+
"esac\n");
}
内容来源于网络,如有侵权,请联系作者删除!