use of com.netflix.spinnaker.halyard.core.resource.v1.StringReplaceJarResource in project halyard by spinnaker.
the class BakeDebianServiceProvider method getInstallCommand.
@Override
public String getInstallCommand(DeploymentDetails deploymentDetails, GenerateService.ResolvedConfiguration resolvedConfiguration, Map<String, String> installCommands, String startupCommand) {
Map<String, Object> bindings = new HashMap<>();
List<SpinnakerService.Type> serviceTypes = new ArrayList<>(installCommands.keySet()).stream().map(SpinnakerService.Type::fromCanonicalName).collect(Collectors.toList());
List<String> upstartNames = getPrioritizedBakeableServices(serviceTypes).stream().filter(i -> resolvedConfiguration.getServiceSettings(i.getService()).getEnabled()).map(i -> ((BakeDebianService) i).getUpstartServiceName()).filter(Objects::nonNull).collect(Collectors.toList());
List<String> systemdServiceConfigs = upstartNames.stream().map(n -> n + ".service").collect(Collectors.toList());
List<String> serviceInstalls = serviceTypes.stream().map(t -> installCommands.get(t.getCanonicalName())).collect(Collectors.toList());
TemplatedResource resource = new StringReplaceJarResource("/debian/init.sh");
bindings.put("services", Strings.join(upstartNames, " "));
bindings.put("systemd-service-configs", Strings.join(systemdServiceConfigs, " "));
String upstartInit = resource.setBindings(bindings).toString();
BillOfMaterials.ArtifactSources artifactSources = artifactService.getArtifactSources(deploymentDetails.getDeploymentName());
resource = new StringReplaceJarResource("/debian/pre-bake.sh");
bindings = new HashMap<>();
bindings.put("debian-repository", artifactSourcesConfig.mergeWithBomSources(artifactSources).getDebianRepository());
bindings.put("install-commands", String.join("\n", serviceInstalls));
bindings.put("upstart-init", upstartInit);
bindings.put("startup-file", Paths.get(startupScriptPath, "startup.sh").toString());
bindings.put("startup-command", startupCommand);
return resource.setBindings(bindings).toString();
}
use of com.netflix.spinnaker.halyard.core.resource.v1.StringReplaceJarResource in project halyard by spinnaker.
the class LocalDebianServiceProvider method clean.
@Override
public RemoteAction clean(DeploymentDetails details, SpinnakerRuntimeSettings runtimeSettings) {
String uninstallArtifacts = String.join("\n", getServices().stream().filter(s -> s != null && runtimeSettings.getServiceSettings(s).getEnabled()).map(s -> ((LocalDebianService) s).uninstallArtifactCommand()).collect(Collectors.toList()));
Map<String, Object> bindings = new HashMap<>();
TemplatedResource resource = new StringReplaceJarResource("/debian/uninstall.sh");
bindings.put("uninstall-artifacts", uninstallArtifacts);
return new RemoteAction().setScript(resource.setBindings(bindings).toString()).setAutoRun(true).setScriptDescription("This script apt-get purges all spinnaker components & deletes their config");
}
use of com.netflix.spinnaker.halyard.core.resource.v1.StringReplaceJarResource in project halyard by spinnaker.
the class NestableCommand method commandCompletor.
public String commandCompletor() {
StringReplaceJarResource completorBody = new StringReplaceJarResource("/hal-completor-body");
Map<String, Object> bindings = new HashMap<>();
String body = commandCompletorCase(0);
bindings.put("body", body);
return completorBody.setBindings(bindings).toString();
}
Aggregations