@Override protected String[] getCommandArguments(String cliPathExec) { if (machineName == null) { throw new IllegalArgumentException("Machine Name cannot be null and couldn't be autoresolved."); } return new String[] {createDockerMachineCommand(cliPathExec), "ip", machineName}; }
@Override protected String[] getCommandArguments(String cliPathExec) { if (machineName == null) { throw new IllegalArgumentException("Machine Name cannot be null and couldn't be autoresolved."); } return new String[] {createDockerMachineCommand(cliPathExec), "ip", machineName}; }
/** * Starts given docker machine. * * @param cliPathExec * location of docker-machine or null if it is on PATH. * @param machineName * to be started. */ public void startDockerMachine(String cliPathExec, String machineName) { commandLineExecutor.execCommand(createDockerMachineCommand(cliPathExec), "start", machineName); this.manuallyStarted = true; }
public void stopDockerMachine(String cliPathExec, String machineName) { commandLineExecutor.execCommand(createDockerMachineCommand(cliPathExec), "stop", machineName); this.manuallyStarted = false; }
public void stopDockerMachine(String cliPathExec, String machineName) { commandLineExecutor.execCommand(createDockerMachineCommand(cliPathExec), "stop", machineName); this.manuallyStarted = false; }
/** * Starts given docker machine. * * @param cliPathExec * location of docker-machine or null if it is on PATH. * @param machineName * to be started. */ public void startDockerMachine(String cliPathExec, String machineName) { commandLineExecutor.execCommand(createDockerMachineCommand(cliPathExec), "start", machineName); this.manuallyStarted = true; }
/** * Checks if Docker Machine is installed by running docker-machine and inspect the result. * * @param cliPathExec * location of docker-machine or null if it is on PATH. * * @return true if it is installed, false otherwise. */ public boolean isDockerMachineInstalled(String cliPathExec) { try { commandLineExecutor.execCommand(createDockerMachineCommand(cliPathExec)); return true; } catch (Exception e) { return false; } }
/** * Checks if Docker Machine is installed by running docker-machine and inspect the result. * * @param cliPathExec * location of docker-machine or null if it is on PATH. * * @return true if it is installed, false otherwise. */ public boolean isDockerMachineInstalled(String cliPathExec) { try { commandLineExecutor.execCommand(createDockerMachineCommand(cliPathExec)); return true; } catch (Exception e) { return false; } }
/** * Executes docker-machine ls command * * @param cliPathExec * location of docker-machine or null if it is on PATH. * * @return set of machines */ public Set<Machine> list(String cliPathExec) { Set<Machine> machines = new HashSet<>(); List<String> output = commandLineExecutor.execCommandAsArray(createDockerMachineCommand(cliPathExec), "ls"); Map<String, Index> headerIndex = calculateStartingFieldsIndex(output.get(0)); for (String fields : output.subList(1, output.size())) { machines.add(parse(headerIndex, fields)); } return machines; }
/** * Executes docker-machine ls command * * @param cliPathExec * location of docker-machine or null if it is on PATH. * * @return set of machines */ public Set<Machine> list(String cliPathExec) { Set<Machine> machines = new HashSet<>(); List<String> output = commandLineExecutor.execCommandAsArray(createDockerMachineCommand(cliPathExec), "ls"); Map<String, Index> headerIndex = calculateStartingFieldsIndex(output.get(0)); for (String fields : output.subList(1, output.size())) { machines.add(parse(headerIndex, fields)); } return machines; }
/** * Executes docker-machine ls --filter field=value command * * @param cliPathExec * location of docker-machine or null if it is on PATH. * @param field * to use in condition * @param value * value that the field should have * * @return set of machines */ public Set<Machine> list(String cliPathExec, String field, String value) { final Set<Machine> machines = new HashSet<>(); List<String> output = commandLineExecutor.execCommandAsArray(createDockerMachineCommand(cliPathExec), "ls", "--filter", field + "=" + value); output = findHeader(output); if (!output.isEmpty()) { final Map<String, Index> headerIndex = calculateStartingFieldsIndex(output.get(0)); for (String fields : output.subList(1, output.size())) { machines.add(parse(headerIndex, fields)); } } return machines; }
/** * Executes docker-machine ls --filter field=value command * * @param cliPathExec * location of docker-machine or null if it is on PATH. * @param field * to use in condition * @param value * value that the field should have * * @return set of machines */ public Set<Machine> list(String cliPathExec, String field, String value) { final Set<Machine> machines = new HashSet<>(); List<String> output = commandLineExecutor.execCommandAsArray(createDockerMachineCommand(cliPathExec), "ls", "--filter", field + "=" + value); output = findHeader(output); if (!output.isEmpty()) { final Map<String, Index> headerIndex = calculateStartingFieldsIndex(output.get(0)); for (String fields : output.subList(1, output.size())) { machines.add(parse(headerIndex, fields)); } } return machines; }