use of io.fabric8.gateway.handlers.detecting.protocol.openwire.command.Command in project docker-maven-plugin by fabric8io.
the class RunService method execInContainer.
/**
* Create and start a Exec container with the given image configuration.
* @param containerId container id to run exec command against
* @param command command to execute
* @param imageConfiguration configuration of the container's image
* @return the exec container id
*
* @throws DockerAccessException if access to the docker backend fails
*/
public String execInContainer(String containerId, String command, ImageConfiguration imageConfiguration) throws DockerAccessException, ExecException {
Arguments arguments = new Arguments();
arguments.setExec(Arrays.asList(EnvUtil.splitOnSpaceWithEscape(command)));
String execContainerId = docker.createExecContainer(containerId, arguments);
docker.startExecContainer(execContainerId, logConfig.createSpec(containerId, imageConfiguration));
ExecDetails execContainer = docker.getExecContainer(execContainerId);
Integer exitCode = execContainer.getExitCode();
if (exitCode != null && exitCode != 0) {
ContainerDetails container = docker.getContainer(containerId);
throw new ExecException(execContainer, container);
}
return execContainerId;
}
use of io.fabric8.gateway.handlers.detecting.protocol.openwire.command.Command in project docker-maven-plugin by fabric8io.
the class DockerAccessWinIT method testCreateContainer.
private void testCreateContainer() throws DockerAccessException {
PortMapping portMapping = new PortMapping(Arrays.asList(new String[] { PORT + ":" + PORT }), new Properties());
ContainerHostConfig hostConfig = new ContainerHostConfig().portBindings(portMapping);
ContainerCreateConfig createConfig = new ContainerCreateConfig(IMAGE).command(new Arguments("ping google.com")).hostConfig(hostConfig);
containerId = dockerClient.createContainer(createConfig, CONTAINER_NAME);
assertNotNull(containerId);
String name = dockerClient.getContainer(containerId).getName();
assertEquals(CONTAINER_NAME, name);
}
use of io.fabric8.gateway.handlers.detecting.protocol.openwire.command.Command in project docker-maven-plugin by fabric8io.
the class DockerAccessIT method testCreateContainer.
private void testCreateContainer() throws DockerAccessException {
PortMapping portMapping = new PortMapping(Arrays.asList(new String[] { PORT + ":" + PORT }), new Properties());
ContainerHostConfig hostConfig = new ContainerHostConfig().portBindings(portMapping);
ContainerCreateConfig createConfig = new ContainerCreateConfig(IMAGE).command(new Arguments("ping google.com")).hostConfig(hostConfig);
containerId = dockerClient.createContainer(createConfig, CONTAINER_NAME);
assertNotNull(containerId);
String name = dockerClient.getContainer(containerId).getName();
assertEquals(CONTAINER_NAME, name);
}
use of io.fabric8.gateway.handlers.detecting.protocol.openwire.command.Command in project fabric8 by jboss-fuse.
the class FabricGitSummaryAction method performContainerAction.
@Override
protected void performContainerAction(String queuePath, String containerName) throws Exception {
JMXRequest containerRequest = new JMXRequest().withObjectName("io.fabric8:type=Fabric").withMethod("gitVersions");
requests.put(containerName, containerRequest);
String command = map(containerRequest);
curator.create().withMode(CreateMode.PERSISTENT_SEQUENTIAL).forPath(queuePath, PublicStringSerializer.serialize(command));
}
use of io.fabric8.gateway.handlers.detecting.protocol.openwire.command.Command in project fabric8 by jboss-fuse.
the class FabricGitSummaryAction method beforeEachContainer.
@Override
protected void beforeEachContainer(Collection<String> names) throws Exception {
// first, we need summary from fabric-git-server (to have something to compare local git repositories to)
master = fabricService.getGitMaster();
if (master == null) {
System.out.println("Can't find container which is current git master");
return;
}
System.out.println("Git master is: " + master);
// ask master about the status first
String queuePath = ZkPath.COMMANDS_REQUESTS_QUEUE.getPath(master);
masterRequest = new JMXRequest().withObjectName("io.fabric8:type=GitServer").withMethod("gitVersions");
String command = map(masterRequest);
curator.create().withMode(CreateMode.PERSISTENT_SEQUENTIAL).forPath(queuePath, PublicStringSerializer.serialize(command));
}
Aggregations