Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Coulon2016-01-15 15:17:33 +0000
committerJeff Johnston2016-01-18 17:57:42 +0000
commit4efe6175fba2ee2d8d62cbc51c5957a04d109d7f (patch)
treee1972af7b0eb95a80949dc437de8569ba591f617
parent72f13dec87d463cec3a105623905026153c1b5d2 (diff)
downloadorg.eclipse.linuxtools-4efe6175fba2ee2d8d62cbc51c5957a04d109d7f.tar.gz
org.eclipse.linuxtools-4efe6175fba2ee2d8d62cbc51c5957a04d109d7f.tar.xz
org.eclipse.linuxtools-4efe6175fba2ee2d8d62cbc51c5957a04d109d7f.zip
Bug 485910 - Add missing "Labels" from Container info
labels were already returned by the underlying Docker client but not collected in the DockerContainerInfo new labels() method is not exposed in the API yet (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=485936) Change-Id: I4f5eb68a5bdcfe49cbfc49f3e272dcb58ba1491d Signed-off-by: Xavier Coulon <xcoulon@redhat.com> Reviewed-on: https://git.eclipse.org/r/64451 Tested-by: Hudson CI Reviewed-by: Jeff Johnston <jjohnstn@redhat.com> (cherry picked from commit 640a4b1e557d05396950e50cf0029d2b1d834ed1) Reviewed-on: https://git.eclipse.org/r/64585
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerContainerConfig.java3
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerContainerConfig.java18
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/ContainerInspectContentProvider.java3
3 files changed, 24 insertions, 0 deletions
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerContainerConfig.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerContainerConfig.java
index f4791e1a45..6139b4b419 100644
--- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerContainerConfig.java
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerContainerConfig.java
@@ -61,4 +61,7 @@ public interface IDockerContainerConfig {
public List<String> onBuild();
+ // FIXME: to be included in Neon
+ // public Map<String, String> labels();
+
}
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerContainerConfig.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerContainerConfig.java
index 5cd8a90aa0..bc9fa81eef 100644
--- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerContainerConfig.java
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerContainerConfig.java
@@ -14,6 +14,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
@@ -47,6 +48,7 @@ public class DockerContainerConfig implements IDockerContainerConfig {
private final List<String> entrypoint;
private final boolean networkDisabled;
private final List<String> onBuild;
+ private final Map<String, String> labels;
public DockerContainerConfig(final ContainerConfig containerConfig) {
this.hostname = containerConfig != null ? containerConfig.hostname()
@@ -96,6 +98,7 @@ public class DockerContainerConfig implements IDockerContainerConfig {
? containerConfig.networkDisabled() : false;
this.onBuild = containerConfig != null ? containerConfig.onBuild()
: null;
+ this.labels = containerConfig != null ? containerConfig.labels() : null;
}
private DockerContainerConfig(final Builder builder) {
@@ -126,6 +129,7 @@ public class DockerContainerConfig implements IDockerContainerConfig {
this.networkDisabled = builder.networkDisabled != null
? builder.networkDisabled : false;
this.onBuild = builder.onBuild;
+ this.labels = builder.labels;
}
@Override
@@ -274,6 +278,14 @@ public class DockerContainerConfig implements IDockerContainerConfig {
return onBuild;
}
+ // @Override
+ public Map<String, String> labels() {
+ if (this.labels == null) {
+ return Collections.emptyMap();
+ }
+ return this.labels;
+ }
+
public static class Builder {
private String hostname;
@@ -299,6 +311,7 @@ public class DockerContainerConfig implements IDockerContainerConfig {
private List<String> entrypoint;
private Boolean networkDisabled;
private List<String> onBuild;
+ private Map<String, String> labels;
public Builder hostname(final String hostname) {
this.hostname = hostname;
@@ -558,6 +571,11 @@ public class DockerContainerConfig implements IDockerContainerConfig {
return onBuild;
}
+ public Builder labels(final Map<String, String> labels) {
+ this.labels = labels;
+ return this;
+ }
+
public DockerContainerConfig build() {
return new DockerContainerConfig(this);
}
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/ContainerInspectContentProvider.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/ContainerInspectContentProvider.java
index e917384a74..1076a2f8c8 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/ContainerInspectContentProvider.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/ContainerInspectContentProvider.java
@@ -23,6 +23,7 @@ import org.eclipse.linuxtools.docker.core.IDockerContainerState;
import org.eclipse.linuxtools.docker.core.IDockerHostConfig;
import org.eclipse.linuxtools.docker.core.IDockerNetworkSettings;
import org.eclipse.linuxtools.docker.core.IDockerPortBinding;
+import org.eclipse.linuxtools.internal.docker.core.DockerContainerConfig;
/**
* @author xcoulon
@@ -110,6 +111,8 @@ public class ContainerInspectContentProvider implements ITreeContentProvider {
new Object[]{"ExposedPorts", LabelUtils.reduce(config.exposedPorts())}, //$NON-NLS-1$
new Object[]{"Hostname", config.hostname()}, //$NON-NLS-1$
new Object[]{"Image", config.image()}, //$NON-NLS-1$
+ new Object[] { "Labels", //$NON-NLS-1$
+ ((DockerContainerConfig) config).labels() },
new Object[]{"Memory", config.memory()}, //$NON-NLS-1$
new Object[]{"MemorySwap", config.memorySwap()}, //$NON-NLS-1$
new Object[]{"NetworkDisabled", config.networkDisabled()}, //$NON-NLS-1$

Back to the top