Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/incubator-slider into develop
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/7f195f66 Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/7f195f66 Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/7f195f66 Branch: refs/heads/develop Commit: 7f195f66213d87f618d38e978baafc025db00a86 Parents: 210a1c9 3f07afb Author: Sumit Mohanty <smoha...@hortonworks.com> Authored: Wed Mar 18 14:44:11 2015 -0700 Committer: Sumit Mohanty <smoha...@hortonworks.com> Committed: Wed Mar 18 14:44:11 2015 -0700 ---------------------------------------------------------------------- .../apache/slider/providers/agent/AgentProviderService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/7f195f66/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java ---------------------------------------------------------------------- diff --cc slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java index d2298f0,cc193f4..4b5f582 --- a/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java +++ b/slider-core/src/main/java/org/apache/slider/providers/agent/AgentProviderService.java @@@ -1699,23 -1660,15 +1699,23 @@@ public class AgentProviderService exten Map<String, Map<String, String>> configurations = buildCommandConfigurations(appConf, containerId, componentName); cmd.setConfigurations(configurations); - Map<String, Map<String, String>> componentConfigurations = buildComponentConfigurations(appConf); - cmd.setComponentConfigurations(componentConfigurations); - - cmd.setCommandParams(setCommandParameters(scriptPath, timeout, false)); + if(SliderUtils.isSet(scriptPath)) { + cmd.setCommandParams(commandParametersSet(scriptPath, timeout, false)); + } else { + // assume it to be default shell command + ComponentCommand effectiveCommand = compCmd; + if(effectiveCommand == null) { + effectiveCommand = ComponentCommand.getDefaultComponentCommand("INSTALL"); + } + cmd.setCommandParams(commandParametersSet(effectiveCommand, timeout, false)); + configurations.get("global").put("exec_cmd", effectiveCommand.getExec()); + } cmd.setHostname(getClusterInfoPropertyValue(StatusKeys.INFO_AM_HOSTNAME)); + response.addExecutionCommand(cmd); - log.debug("command looks like: " + cmd.toString()); + log.debug("command looks like: {} ", cmd); } private Map<String, Map<String, String>> buildComponentConfigurations( @@@ -1726,21 -1679,14 +1726,21 @@@ protected static String getPackageListFromApplication(Application application) { String pkgFormatString = "{\"type\":\"%s\",\"name\":\"%s\"}"; String pkgListFormatString = "[%s]"; - List<String> packages = new ArrayList(); + List<String> packages = new ArrayList<>(); if (application != null) { - List<OSSpecific> osSpecifics = application.getOSSpecifics(); - if (osSpecifics != null && osSpecifics.size() > 0) { - for (OSSpecific osSpecific : osSpecifics) { - if (osSpecific.getOsType().equals("any")) { - for (OSPackage osPackage : osSpecific.getPackages()) { - packages.add(String.format(pkgFormatString, osPackage.getType(), osPackage.getName())); + if (application.getPackages().size() > 0) { + List<Package> appPackages = application.getPackages(); + for (Package appPackage : appPackages) { + packages.add(String.format(pkgFormatString, appPackage.getType(), appPackage.getName())); + } + } else { + List<OSSpecific> osSpecifics = application.getOSSpecifics(); + if (osSpecifics != null && osSpecifics.size() > 0) { + for (OSSpecific osSpecific : osSpecifics) { + if (osSpecific.getOsType().equals("any")) { + for (OSPackage osPackage : osSpecific.getPackages()) { + packages.add(String.format(pkgFormatString, osPackage.getType(), osPackage.getName())); + } } } } @@@ -1872,22 -1804,17 +1872,22 @@@ cmd.setRoleParams(roleParams); cmd.getRoleParams().put("auto_restart", Boolean.toString(isMarkedAutoRestart)); - cmd.setCommandParams(setCommandParameters(scriptPath, timeout, true)); - - Map<String, Map<String, String>> componentConfigurations = buildComponentConfigurations(appConf); - cmd.setComponentConfigurations(componentConfigurations); - Map<String, Map<String, String>> configurations = buildCommandConfigurations(appConf, containerId, componentName); - cmd.setConfigurations(configurations); + + if(SliderUtils.isSet(scriptPath)) { + cmd.setCommandParams(commandParametersSet(scriptPath, timeout, true)); + } else { + if(startCommand == null) { + throw new SliderException("Expected START command not found for component " + componentName); + } + cmd.setCommandParams(commandParametersSet(startCommand, timeout, true)); + configurations.get("global").put("exec_cmd", startCommand.getExec()); + } + response.addExecutionCommand(cmd); - log.debug("command looks like: " + cmd.toString()); + log.debug("command looks like: {}", cmd); // With start command, the corresponding command for graceful stop needs to // be sent. This will be used when a particular container is lost as per RM, // but then the agent is still running and heart-beating to the Slider AM.