public String getSpinnakerStagingPath(String deploymentName) { return halconfigDirectoryStructure.getStagingPath(deploymentName).toString(); }
public Path getStagingDependenciesPath(String deploymentName) { Path staging = getStagingPath(deploymentName); return ensureDirectory(Paths.get(staging.toString(), "dependencies")); }
public Path getUserProfilePath(String deploymentName) { return ensureRelativeHalDirectory(deploymentName, "profiles"); }
public Path getServiceLogsPath(String deploymentName, String hostname, String serviceName) { Path halconfigPath = Paths.get(getLogsPath(deploymentName).toString(), hostname, serviceName); ensureDirectory(halconfigPath); return halconfigPath; }
private Path ensureRelativeHalDirectory(String deploymentName, String directoryName) { Path path = Paths.get(halconfigDirectory, deploymentName, directoryName); ensureDirectory(path); return path; }
Path serviceSettingsPath = halconfigDirectoryStructure.getServiceSettingsPath(deploymentName); configParser.atomicWrite(serviceSettingsPath, resolvedConfiguration.getRuntimeSettings()); Path serviceProfilesPath = halconfigDirectoryStructure.getServiceProfilesPath(deploymentName); configParser.atomicWrite(serviceProfilesPath, resolvedConfiguration.getServiceProfiles()); action.commitScript(halconfigDirectoryStructure.getInstallScriptPath(deploymentName));
public String create() { String halconfigDir = directoryStructure.getHalconfigDirectory(); halconfigParser.backupConfig(); Halconfig halconfig = halconfigParser.getHalconfig(); halconfig.backupLocalFiles(directoryStructure.getBackupConfigDependenciesPath().toString()); halconfig.makeLocalFilesRelative(halconfigDir); halconfigParser.saveConfig(); String tarOutputName = String.format("halbackup-%s.tar", new Date()).replace(" ", "_").replace(":", "-"); String halconfigTar = Paths.get(System.getProperty("user.home"), tarOutputName).toString(); try { tarHalconfig(halconfigDir, halconfigTar); } catch (IOException e) { throw new HalException(Problem.Severity.FATAL, "Unable to safely backup halconfig " + e.getMessage(), e); } finally { halconfigParser.switchToBackupConfig(); halconfigParser.getHalconfig(); halconfigParser.saveConfig(); halconfigParser.switchToPrimaryConfig(); } return halconfigTar; }
public void switchToBackupConfig() { DaemonTaskHandler.setContext(null); backupHalconfigPath = halconfigDirectoryStructure.getBackupConfigPath().toString(); useBackup = true; }
public void restore(String backupTar) { String halconfigDir = directoryStructure.getHalconfigDirectory(); untarHalconfig(halconfigDir, backupTar); Halconfig halconfig = halconfigParser.getHalconfig(); halconfig.makeLocalFilesAbsolute(halconfigDir); halconfigParser.saveConfig(); }
public RemoteAction connectCommand(String deploymentName, List<String> serviceNames) { DeploymentConfiguration deploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName); SpinnakerServiceProvider<DeploymentDetails> serviceProvider = serviceProviderFactory.create(deploymentConfiguration); SpinnakerRuntimeSettings runtimeSettings = serviceProvider.buildRuntimeSettings(deploymentConfiguration); Deployer deployer = getDeployer(deploymentConfiguration); DeploymentDetails deploymentDetails = getDeploymentDetails(deploymentConfiguration); List<SpinnakerService.Type> serviceTypes = serviceNames.stream() .map(SpinnakerService.Type::fromCanonicalName) .collect(Collectors.toList()); if (serviceTypes.isEmpty()) { serviceTypes.add(SpinnakerService.Type.DECK); serviceTypes.add(SpinnakerService.Type.GATE); } RemoteAction result = deployer.connectCommand(serviceProvider, deploymentDetails, runtimeSettings, serviceTypes); result.setAutoRun(true); result.commitScript(halconfigDirectoryStructure.getConnectScriptPath(deploymentName)); return result; }
public RemoteAction prep(String deploymentName, List<String> serviceNames, List<String> excludeServiceNames) { DeploymentConfiguration deploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName); DeploymentDetails deploymentDetails = getDeploymentDetails(deploymentConfiguration); Deployer deployer = getDeployer(deploymentConfiguration); SpinnakerServiceProvider<DeploymentDetails> serviceProvider = serviceProviderFactory.create(deploymentConfiguration); SpinnakerRuntimeSettings runtimeSettings = serviceProvider.buildRuntimeSettings(deploymentConfiguration); List<SpinnakerService.Type> serviceTypes = serviceNames.stream() .map(SpinnakerService.Type::fromCanonicalName) .collect(Collectors.toList()); if (serviceTypes.isEmpty()) { serviceTypes = serviceProvider .getServices() .stream() .map(SpinnakerService::getType) .collect(Collectors.toList()); } if (!excludeServiceNames.isEmpty()) { serviceTypes = serviceTypes .stream() .filter(serviceType -> !excludeServiceNames.contains(serviceType.getCanonicalName())) .collect(Collectors.toList()); } RemoteAction action = deployer.prep(serviceProvider, deploymentDetails, runtimeSettings, serviceTypes); if (!action.getScript().isEmpty()) { action.commitScript(halconfigDirectoryStructure.getPrepScriptPath(deploymentName)); } return action; }
private Path ensureRelativeHalDirectory(String deploymentName, String directoryName) { Path path = Paths.get(halconfigDirectory, deploymentName, directoryName); ensureDirectory(path); return path; }
Path serviceSettingsPath = halconfigDirectoryStructure.getServiceSettingsPath(deploymentName); configParser.atomicWrite(serviceSettingsPath, resolvedConfiguration.getRuntimeSettings()); Path serviceProfilesPath = halconfigDirectoryStructure.getServiceProfilesPath(deploymentName); configParser.atomicWrite(serviceProfilesPath, resolvedConfiguration.getServiceProfiles()); action.commitScript(halconfigDirectoryStructure.getInstallScriptPath(deploymentName));
public Path getServiceLogsPath(String deploymentName, String hostname, String serviceName) { Path halconfigPath = Paths.get(getLogsPath(deploymentName).toString(), hostname, serviceName); ensureDirectory(halconfigPath); return halconfigPath; }
public String create() { String halconfigDir = directoryStructure.getHalconfigDirectory(); halconfigParser.backupConfig(); Halconfig halconfig = halconfigParser.getHalconfig(); halconfig.backupLocalFiles(directoryStructure.getBackupConfigDependenciesPath().toString()); halconfig.makeLocalFilesRelative(halconfigDir); halconfigParser.saveConfig(); String tarOutputName = String.format("halbackup-%s.tar", new Date()).replace(" ", "_").replace(":", "-"); String halconfigTar = Paths.get(System.getProperty("user.home"), tarOutputName).toString(); try { tarHalconfig(halconfigDir, halconfigTar); } catch (IOException e) { throw new HalException(Problem.Severity.FATAL, "Unable to safely backup halconfig " + e.getMessage(), e); } finally { halconfigParser.switchToBackupConfig(); halconfigParser.getHalconfig(); halconfigParser.saveConfig(); halconfigParser.switchToPrimaryConfig(); } return halconfigTar; }
public void switchToBackupConfig() { DaemonTaskHandler.setContext(null); backupHalconfigPath = halconfigDirectoryStructure.getBackupConfigPath().toString(); useBackup = true; }
public void restore(String backupTar) { String halconfigDir = directoryStructure.getHalconfigDirectory(); untarHalconfig(halconfigDir, backupTar); Halconfig halconfig = halconfigParser.getHalconfig(); halconfig.makeLocalFilesAbsolute(halconfigDir); halconfigParser.saveConfig(); }
public RemoteAction connectCommand(String deploymentName, List<String> serviceNames) { DeploymentConfiguration deploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName); SpinnakerServiceProvider<DeploymentDetails> serviceProvider = serviceProviderFactory.create(deploymentConfiguration); SpinnakerRuntimeSettings runtimeSettings = serviceProvider.buildRuntimeSettings(deploymentConfiguration); Deployer deployer = getDeployer(deploymentConfiguration); DeploymentDetails deploymentDetails = getDeploymentDetails(deploymentConfiguration); List<SpinnakerService.Type> serviceTypes = serviceNames.stream() .map(SpinnakerService.Type::fromCanonicalName) .collect(Collectors.toList()); if (serviceTypes.isEmpty()) { serviceTypes.add(SpinnakerService.Type.DECK); serviceTypes.add(SpinnakerService.Type.GATE); } RemoteAction result = deployer.connectCommand(serviceProvider, deploymentDetails, runtimeSettings, serviceTypes); result.setAutoRun(true); result.commitScript(halconfigDirectoryStructure.getConnectScriptPath(deploymentName)); return result; }
public RemoteAction prep(String deploymentName, List<String> serviceNames, List<String> excludeServiceNames) { DeploymentConfiguration deploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName); DeploymentDetails deploymentDetails = getDeploymentDetails(deploymentConfiguration); Deployer deployer = getDeployer(deploymentConfiguration); SpinnakerServiceProvider<DeploymentDetails> serviceProvider = serviceProviderFactory.create(deploymentConfiguration); SpinnakerRuntimeSettings runtimeSettings = serviceProvider.buildRuntimeSettings(deploymentConfiguration); List<SpinnakerService.Type> serviceTypes = serviceNames.stream() .map(SpinnakerService.Type::fromCanonicalName) .collect(Collectors.toList()); if (serviceTypes.isEmpty()) { serviceTypes = serviceProvider .getServices() .stream() .map(SpinnakerService::getType) .collect(Collectors.toList()); } if (!excludeServiceNames.isEmpty()) { serviceTypes = serviceTypes .stream() .filter(serviceType -> !excludeServiceNames.contains(serviceType.getCanonicalName())) .collect(Collectors.toList()); } RemoteAction action = deployer.prep(serviceProvider, deploymentDetails, runtimeSettings, serviceTypes); if (!action.getScript().isEmpty()) { action.commitScript(halconfigDirectoryStructure.getPrepScriptPath(deploymentName)); } return action; }
public String getSpinnakerStagingPath(String deploymentName) { return halconfigDirectoryStructure.getStagingPath(deploymentName).toString(); }