public String getServiceName() { if (_serviceName!=null) return _serviceName; return _serviceName = entity().getConfig(ChefConfig.SERVICE_NAME); }
public String getWindowsServiceName() { if (_windowsServiceName!=null) return _windowsServiceName; return _windowsServiceName = entity().getConfig(ChefConfig.WINDOWS_SERVICE_NAME); }
protected String getPrimaryCookbook() { return entity().getConfig(CHEF_COOKBOOK_PRIMARY_NAME); }
public String getPidFile() { if (_pidFile!=null) return _pidFile; return _pidFile = entity().getConfig(ChefConfig.PID_FILE); }
public String getWindowsServiceName() { if (_windowsServiceName!=null) return _windowsServiceName; return _windowsServiceName = entity().getConfig(ChefConfig.WINDOWS_SERVICE_NAME); }
public String getPidFile() { if (_pidFile!=null) return _pidFile; return _pidFile = entity().getConfig(ChefConfig.PID_FILE); }
public String getServiceName() { if (_serviceName!=null) return _serviceName; return _serviceName = entity().getConfig(ChefConfig.SERVICE_NAME); }
protected String getPrimaryCookbook() { return entity().getConfig(CHEF_COOKBOOK_PRIMARY_NAME); }
protected String getNodeName() { // (node name is needed so we can node delete it) // TODO would be better if CHEF_NODE_NAME were a freemarker template, could access entity.id, or hostname, etc, // in addition to supporting hard-coded node names (which is all we support so far). String nodeName = entity().getConfig(ChefConfig.CHEF_NODE_NAME); if (Strings.isNonBlank(nodeName)) return Strings.makeValidFilename(nodeName); // node name is taken from ID of this entity, if not specified return entity().getId(); }
protected String getNodeName() { // (node name is needed so we can node delete it) // TODO would be better if CHEF_NODE_NAME were a freemarker template, could access entity.id, or hostname, etc, // in addition to supporting hard-coded node names (which is all we support so far). String nodeName = entity().getConfig(ChefConfig.CHEF_NODE_NAME); if (Strings.isNonBlank(nodeName)) return Strings.makeValidFilename(nodeName); // node name is taken from ID of this entity, if not specified return entity().getId(); }
@Override public TemplateModel get(String key) throws TemplateModelException { try { Object result = entity.getConfig(ConfigKeys.builder(Object.class).name(key).build()); if (result==null) result = mgmt.getConfig().getConfig(ConfigKeys.builder(Object.class).name(key).build()); if (result!=null) return wrapAsTemplateModel( result ); } catch (Exception e) { Exceptions.propagateIfFatal(e); throw new IllegalStateException("Error accessing config '"+key+"'"+" on "+entity+": "+e, e); } return null; }
String base = entity.getConfig(BrooklynConfigKeys.ONBOX_BASE_DIR); if (base==null) base = machine.getConfig(BrooklynConfigKeys.ONBOX_BASE_DIR); if (base!=null && Boolean.TRUE.equals(entity.getConfig(ON_BOX_BASE_DIR_RESOLVED))) return base; if (base==null) base = entity.getManagementContext().getConfig().getConfig(BrooklynConfigKeys.ONBOX_BASE_DIR); if (base==null) base = entity.getConfig(BrooklynConfigKeys.BROOKLYN_DATA_DIR); if (base==null) base = machine.getConfig(BrooklynConfigKeys.BROOKLYN_DATA_DIR); if (base==null) base = entity.getManagementContext().getConfig().getConfig(BrooklynConfigKeys.BROOKLYN_DATA_DIR); if (entity.getConfig(BrooklynConfigKeys.SKIP_ON_BOX_BASE_DIR_RESOLUTION) || machine.getConfig(BrooklynConfigKeys.SKIP_ON_BOX_BASE_DIR_RESOLUTION)) { if (log.isDebugEnabled()) log.debug("Skipping on-box base dir resolution for "+entity+" at "+machine); if (!Os.isAbsolutish(base)) base = "~/"+base;
EntitySpec<?> origMemberSpec = entity().getConfig(BrooklynCluster.MEMBER_SPEC); Preconditions.checkNotNull(origMemberSpec, BrooklynCluster.MEMBER_SPEC.getName() + " is required for " + UpgradeClusterEffector.class.getName());
@SuppressWarnings({ "unchecked", "rawtypes", "deprecation" }) protected void startWithKnifeAsync() { // TODO prestart, ports (as above); also, note, some aspects of this are untested as we need a chef server String primary = getPrimaryCookbook(); // put all config under brooklyn/cookbook/config Navigator<MutableMap<Object, Object>> attrs = Jsonya.newInstancePrimitive().at("brooklyn"); if (Strings.isNonBlank(primary)) attrs.at(primary); attrs.at("config"); attrs.put( entity().config().getBag().getAllConfig() ); // and put launch attrs at root try { attrs.root().put((Map<?,?>)Tasks.resolveDeepValue(entity().getConfig(CHEF_LAUNCH_ATTRIBUTES), Object.class, entity().getExecutionContext())); } catch (Exception e) { Exceptions.propagate(e); } Collection<? extends String> runList = entity().getConfig(CHEF_LAUNCH_RUN_LIST); if (runList==null) runList = entity().getConfig(CHEF_RUN_LIST); if (runList==null) { if (Strings.isNonBlank(primary)) runList = ImmutableList.of(primary+"::"+"start"); else throw new IllegalStateException("Require a primary cookbook or a run_list to effect "+"start"+" on "+entity()); } DynamicTasks.queue( ChefServerTasks.knifeConvergeTask() .knifeNodeName(getNodeName()) .knifeRunList(Strings.join(runList, ",")) .knifeAddAttributes((Map) attrs.root().get()) .knifeRunTwice(entity().getConfig(CHEF_RUN_CONVERGE_TWICE)) ); }
@SuppressWarnings({ "unchecked", "rawtypes", "deprecation" }) protected void startWithKnifeAsync() { // TODO prestart, ports (as above); also, note, some aspects of this are untested as we need a chef server String primary = getPrimaryCookbook(); // put all config under brooklyn/cookbook/config Navigator<MutableMap<Object, Object>> attrs = Jsonya.newInstancePrimitive().at("brooklyn"); if (Strings.isNonBlank(primary)) attrs.at(primary); attrs.at("config"); attrs.put( entity().config().getBag().getAllConfig() ); // and put launch attrs at root try { attrs.root().put((Map<?,?>)Tasks.resolveDeepValue(entity().getConfig(CHEF_LAUNCH_ATTRIBUTES), Object.class, entity().getExecutionContext())); } catch (Exception e) { Exceptions.propagate(e); } Collection<? extends String> runList = entity().getConfig(CHEF_LAUNCH_RUN_LIST); if (runList==null) runList = entity().getConfig(CHEF_RUN_LIST); if (runList==null) { if (Strings.isNonBlank(primary)) runList = ImmutableList.of(primary+"::"+"start"); else throw new IllegalStateException("Require a primary cookbook or a run_list to effect "+"start"+" on "+entity()); } DynamicTasks.queue( ChefServerTasks.knifeConvergeTask() .knifeNodeName(getNodeName()) .knifeRunList(Strings.join(runList, ",")) .knifeAddAttributes((Map) attrs.root().get()) .knifeRunTwice(entity().getConfig(CHEF_RUN_CONVERGE_TWICE)) ); }
if (Boolean.TRUE.equals(entity().getConfig(SoftwareProcess.OPEN_IPTABLES))) { if (machine instanceof SshMachineLocation) { @SuppressWarnings("unchecked") if (Boolean.TRUE.equals(entity().getConfig(SoftwareProcess.STOP_IPTABLES))) { if (machine instanceof SshMachineLocation) { machineInitTasks.stopIptablesAsync((SshMachineLocation)machine); if (Boolean.TRUE.equals(entity().getConfig(SoftwareProcess.DONT_REQUIRE_TTY_FOR_SUDO))) { if (machine instanceof SshMachineLocation) { machineInitTasks.dontRequireTtyForSudoAsync((SshMachineLocation)machine);
ConfigBag.newInstance( entity().getConfig(CHEF_COOKBOOK_URLS) ) .putIfAbsent( entity().getConfig(CHEF_COOKBOOK_URLS) ) .getAllConfig(); if (cookbooks.isEmpty()) attrs.root().put((Map<?,?>)Tasks.resolveDeepValue(entity().getConfig(CHEF_LAUNCH_ATTRIBUTES), Object.class, entity().getExecutionContext())); } catch (Exception e) { Exceptions.propagate(e); } Collection<? extends String> runList = entity().getConfig(CHEF_LAUNCH_RUN_LIST); if (runList==null) runList = entity().getConfig(CHEF_RUN_LIST); if (runList==null) { if (Strings.isNonBlank(primary)) runList = ImmutableList.of(primary+"::"+"start"); runList, (Map<String, Object>) attrs.root().get())); DynamicTasks.queue(ChefSoloTasks.runChef(runDir, "launch", entity().getConfig(CHEF_RUN_CONVERGE_TWICE)));
ConfigBag.newInstance( entity().getConfig(CHEF_COOKBOOK_URLS) ) .putIfAbsent( entity().getConfig(CHEF_COOKBOOK_URLS) ) .getAllConfig(); if (cookbooks.isEmpty()) attrs.root().put((Map<?,?>)Tasks.resolveDeepValue(entity().getConfig(CHEF_LAUNCH_ATTRIBUTES), Object.class, entity().getExecutionContext())); } catch (Exception e) { Exceptions.propagate(e); } Collection<? extends String> runList = entity().getConfig(CHEF_LAUNCH_RUN_LIST); if (runList==null) runList = entity().getConfig(CHEF_RUN_LIST); if (runList==null) { if (Strings.isNonBlank(primary)) runList = ImmutableList.of(primary+"::"+"start"); runList, (Map<String, Object>) attrs.root().get())); DynamicTasks.queue(ChefSoloTasks.runChef(runDir, "launch", entity().getConfig(CHEF_RUN_CONVERGE_TWICE)));
@Override public MachineLocation call() throws Exception { entity().getConfig(BrooklynConfigKeys.PROVISION_LATCH); final Map<String, Object> flags = obtainProvisioningFlags(location); if (!(location instanceof LocalhostMachineProvisioningLocation))
@Override public void run() { DynamicTasks.waitForLast(); entity().sensors().set(SoftwareProcess.INSTALL_DIR, (String)null); entity().config().set(SoftwareProcess.INSTALL_UNIQUE_LABEL, (String)null); entity().config().putAll(parameters.getAllConfig()); entity().sensors().set(BrooklynNode.DOWNLOAD_URL, entity().getConfig(DOWNLOAD_URL)); // Setting SUGGESTED_VERSION will result in an new empty INSTALL_FOLDER, but clear it // just in case the user specified already installed version. ((BrooklynNodeDriver)((DriverDependentEntity<?>)entity()).getDriver()).clearInstallDir(); } }).build());