/** knife converge task configured for this run list (and sudo) */ public static KnifeConvergeTaskFactory<String> knifeConvergeRunList(String runList) { return knifeConvergeTask() .knifeRunList(runList) .knifeSudo(true); }
/** knife converge task configured for this run list on windows (winrm) */ public static KnifeConvergeTaskFactory<String> knifeConvergeRunListWindowsWinrm(String runList) { return knifeConvergeTask() .knifeRunList(runList) .knifeSudo(false) .knifeAddExtraBootstrapParameters("windows winrm") .knifePortUseKnifeDefault(); }
public KnifeConvergeTaskFactory<RET> knifeAddParameters(String word1, String ...words) { super.knifeAddParameters(word1, words); return self(); }
public static KnifeTaskFactory<Boolean> isKnifeInstalled() { return new KnifeTaskFactory<Boolean>("knife install check") .knifeAddParameters("node list") .notThrowingOnCommonKnifeErrors() .returningIsExitCodeZero(); }
@Override public void install() { // TODO flag to force reinstallation DynamicTasks.queue( ChefSoloTasks.installChef(getInstallDir(), false), ChefSoloTasks.installCookbooks(getInstallDir(), getRequiredConfig(CHEF_COOKBOOKS), false)); }
protected <T> T getRequiredConfig(ConfigKey<T> key) { return ChefConfigs.getRequiredConfig(getEntity(), key); }
/** Inserts the knife command at the current place in the list. * Can be run multiple times. The knife command added at the end of the list * if this is not invoked (and it is the only command if nothing is {@link #add(String...)}ed. */ public KnifeTaskFactory<RET> addKnifeCommandToScript() { add(KNIFE_PLACEHOLDER); return self(); }
/** plain knife converge task - run list must be set, other arguments are optional */ public static KnifeConvergeTaskFactory<String> knifeConvergeTask() { return new KnifeConvergeTaskFactory<String>("knife converge") .requiringZeroAndReturningStdout(); } /** knife converge task configured for this run list (and sudo) */
public static void addToCookbooksFromGithub(EntitySpec<?> entity, String ...cookbookNames) { for (String cookbookName: cookbookNames) addToCookbooksFromGithub(entity, cookbookName, getGithubOpscodeRepo(cookbookName)); }
/** whether knife should attempt to run twice; * see {@link ChefConfig#CHEF_RUN_CONVERGE_TWICE} */ public KnifeConvergeTaskFactory<RET> knifeRunTwice(boolean runTwice) { this.runTwice = runTwice; return self(); }
public ChefAttributeFeed build() { built = true; ChefAttributeFeed result = new ChefAttributeFeed(this); result.start(); return result; } @Override
@Override public void onError(Exception exception) { onException(exception); }
public KnifeTaskFactory<RET> knifeSetupCommands(String knifeSetupCommands) { this.knifeSetupCommands = knifeSetupCommands; return self(); }
@Override public <T2> KnifeConvergeTaskFactory<T2> returning(ScriptReturnType type) { return (KnifeConvergeTaskFactory<T2>) super.<T2>returning(type); }
@Override public KnifeConvergeTaskFactory<Boolean> returningIsExitCodeZero() { return (KnifeConvergeTaskFactory<Boolean>) super.returningIsExitCodeZero(); }
public Builder period(long millis) { return period(millis, TimeUnit.MILLISECONDS); } public Builder period(long val, TimeUnit units) {
/** knife converge task configured for this run list on windows (ssh) */ public static KnifeConvergeTaskFactory<String> knifeConvergeRunListWindowsSsh(String runList) { return knifeConvergeTask() .knifeRunList(runList) .knifeSudo(false) .knifeAddExtraBootstrapParameters("windows ssh"); }
/** function supplying the run list to be passed to knife, evaluated at the last moment */ public KnifeConvergeTaskFactory<RET> knifeRunList(Function<? super Entity, String> runList) { this.runList = runList; return self(); } public KnifeConvergeTaskFactory<RET> knifeRunList(String runList) {
/** what node name to pass to knife; default = null, meaning chef-client will pick the node name */ public KnifeConvergeTaskFactory<RET> knifeNodeName(String nodeName) { this.nodeName = nodeName; return self(); }
/** whether to pass --sudo to knife; default true */ public KnifeConvergeTaskFactory<RET> knifeSudo(boolean sudo) { this.sudo = sudo; return self(); }