/** allows a way for subclasses to build up parameters at the start */ protected List<String> initialKnifeParameters() { return new MutableList<String>(); }
/** allows a way for subclasses to build up parameters at the start */ protected List<String> initialKnifeParameters() { return new MutableList<String>(); }
public static <V> MutableList<V> of() { return new MutableList<V>(); }
public MutableList<V> build() { return new MutableList<V>(result); }
public static <V> MutableList<V> copyOf(@Nullable Iterable<? extends V> orig) { return (orig instanceof Collection) ? new MutableList<V>((Collection<? extends V>)orig) : orig!=null ? new MutableList<V>(orig) : new MutableList<V>(); }
public static <V> MutableList<V> of(V v1) { MutableList<V> result = new MutableList<V>(); result.add(v1); return result; }
public static <V> MutableList<V> of(V v1, V v2, V ...vv) { MutableList<V> result = new MutableList<V>(); result.add(v1); result.add(v2); for (V v: vv) result.add(v); return result; }
/** executes a set of commands by sending them as a single process to `bash -c` * (single command argument of all the commands, joined with separator) * <p> * consequence of this is that you should not normally need to escape things oddly in your commands, * type them just as you would into a bash shell (if you find exceptions please note them here!) */ public static int execProcesses(List<String> cmds, Map<String,?> env, File directory, OutputStream out, OutputStream err, String separator, boolean asLoginShell, Object contextForLogging) { MutableList<String> commands = new MutableList<String>().append("bash"); if (asLoginShell) commands.append("-l"); commands.append("-c", Strings.join(cmds, Preconditions.checkNotNull(separator, "separator"))); return execSingleProcess(commands, env, directory, out, err, contextForLogging); }
protected List<String> initialKnifeParameters() { MutableList<String> result = new MutableList<String>(); SshMachineLocation machine = EffectorTasks.findSshMachine();
protected List<String> initialKnifeParameters() { MutableList<String> result = new MutableList<String>(); SshMachineLocation machine = EffectorTasks.findSshMachine();
componentsByNodeName.put(hostGroup.getName(), new MutableList<String>());
/** creates the command for running knife. * in some cases knife may be added multiple times, * and in that case the parameter here tells which time it is being added, * on a single run. */ protected String buildKnifeCommand(int knifeCommandIndex) { MutableList<String> words = new MutableList<String>(); words.add(knifeExecutable()); words.addAll(initialKnifeParameters()); words.addAll(knifeParameters()); String x = knifeConfigFileOption(); if (Strings.isNonBlank(x)) words.add(knifeConfigFileOption()); return Strings.join(words, " "); }
/** creates the command for running knife. * in some cases knife may be added multiple times, * and in that case the parameter here tells which time it is being added, * on a single run. */ protected String buildKnifeCommand(int knifeCommandIndex) { MutableList<String> words = new MutableList<String>(); words.add(knifeExecutable()); words.addAll(initialKnifeParameters()); words.addAll(knifeParameters()); String x = knifeConfigFileOption(); if (Strings.isNonBlank(x)) words.add(knifeConfigFileOption()); return Strings.join(words, " "); }
@Override public List<String> getCommands() { MutableList<String> result = new MutableList<String>(); String setupCommands = knifeSetupCommands(); if (setupCommands != null && Strings.isNonBlank(setupCommands)) result.add(setupCommands); int numKnifes = 0; for (String c: super.getCommands()) { if (c==KNIFE_PLACEHOLDER) result.add(buildKnifeCommand(numKnifes++)); else result.add(c); } if (numKnifes==0) result.add(buildKnifeCommand(numKnifes++)); return result.asUnmodifiable(); }
@Override public List<String> getCommands() { MutableList<String> result = new MutableList<String>(); String setupCommands = knifeSetupCommands(); if (setupCommands != null && Strings.isNonBlank(setupCommands)) result.add(setupCommands); int numKnifes = 0; for (String c: super.getCommands()) { if (c==KNIFE_PLACEHOLDER) result.add(buildKnifeCommand(numKnifes++)); else result.add(c); } if (numKnifes==0) result.add(buildKnifeCommand(numKnifes++)); return result.asUnmodifiable(); }
protected void applyToIterable() { MutableList<Object> input = MutableList.copyOf((Iterable<?>)originalValue); MutableList<Object> result = new MutableList<Object>(); newValue = result; // first do a "whole-node" application if (getContext().getAllInterpreter().applyListBefore(this, input)) { for (Object entry: input) { // then recurse in to this node and do various in-the-node applications PlanInterpretationNode value = newPlanInterpretation(this, Role.LIST_ENTRY, entry); value.apply(); if (value.isChanged()) changed = true; if (getContext().getAllInterpreter().applyListEntry(this, input, result, value)) result.add(value.getNewValue()); } // finally try applying to this node again getContext().getAllInterpreter().applyListAfter(this, input, result); } if (changed==null) changed = false; }