private Map<String, String> resolveDownloadDockerMachine(Map<String, String> config) { if (config.containsKey(CubeDockerConfiguration.DOCKER_MACHINE_NAME)) { final String cliPathExec = config.get(CubeDockerConfiguration.DOCKER_MACHINE_PATH); if (!dockerMachine.isDockerMachineInstalled(cliPathExec)) { String machineVersion = GitHubUtil.getDockerMachineLatestVersion(); String machineCustomPath = config.get(CubeDockerConfiguration.DOCKER_MACHINE_CUSTOM_PATH); File dockerMachineFile = CubeDockerConfiguration.resolveMachinePath(machineCustomPath, machineVersion); String dockerMachinePath = dockerMachineFile.getPath(); boolean dockerMachineFileExist = dockerMachineFile != null && dockerMachineFile.exists(); String machineName = config.get(CubeDockerConfiguration.DOCKER_MACHINE_NAME); String machineUrl = CubeDockerConfiguration.resolveUrl(machineVersion); if (!dockerMachineFileExist) { dockerMachineFile.getParentFile().mkdirs(); Spacelift.task(DownloadTool.class) .from(machineUrl) .to(dockerMachineFile) .execute() .await(); config.put(CubeDockerConfiguration.DOCKER_MACHINE_PATH, dockerMachinePath); dockerMachine.grantPermissionToDockerMachine(dockerMachinePath); String machineDriver = config.get(CubeDockerConfiguration.DOCKER_MACHINE_DRIVER); dockerMachine.createMachine(dockerMachinePath, machineDriver, machineName); } else { config.put(CubeDockerConfiguration.DOCKER_MACHINE_PATH, dockerMachinePath); } } } return config; }
private Map<String, String> resolveDownloadDockerMachine(Map<String, String> config) { if (config.containsKey(CubeDockerConfiguration.DOCKER_MACHINE_NAME)) { final String cliPathExec = config.get(CubeDockerConfiguration.DOCKER_MACHINE_PATH); if (!dockerMachine.isDockerMachineInstalled(cliPathExec)) { String machineVersion = GitHubUtil.getDockerMachineLatestVersion(); String machineCustomPath = config.get(CubeDockerConfiguration.DOCKER_MACHINE_CUSTOM_PATH); File dockerMachineFile = CubeDockerConfiguration.resolveMachinePath(machineCustomPath, machineVersion); String dockerMachinePath = dockerMachineFile.getPath(); boolean dockerMachineFileExist = dockerMachineFile != null && dockerMachineFile.exists(); String machineName = config.get(CubeDockerConfiguration.DOCKER_MACHINE_NAME); String machineUrl = CubeDockerConfiguration.resolveUrl(machineVersion); if (!dockerMachineFileExist) { dockerMachineFile.getParentFile().mkdirs(); Spacelift.task(DownloadTool.class) .from(machineUrl) .to(dockerMachineFile) .execute() .await(); config.put(CubeDockerConfiguration.DOCKER_MACHINE_PATH, dockerMachinePath); dockerMachine.grantPermissionToDockerMachine(dockerMachinePath); String machineDriver = config.get(CubeDockerConfiguration.DOCKER_MACHINE_DRIVER); dockerMachine.createMachine(dockerMachinePath, machineDriver, machineName); } else { config.put(CubeDockerConfiguration.DOCKER_MACHINE_PATH, dockerMachinePath); } } } return config; }