Skip to content

Commit 76cb823

Browse files
committed
Ref #27992: add method to get used image
1 parent 16fbcd4 commit 76cb823

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/main/java/eu/openanalytics/containerproxy/backend/AbstractContainerBackend.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ public abstract class AbstractContainerBackend implements IContainerBackend {
6969
protected static final String PROPERTY_CONTAINER_PROTOCOL = "container-protocol";
7070
protected static final String PROPERTY_PRIVILEGED = "privileged";
7171

72+
private static final String PARAM_CONTAINER_IMAGE = "CONTAINER_IMAGE";
7273
protected static final String DEFAULT_TARGET_PROTOCOL = "http";
7374
protected final Logger log = LogManager.getLogger(getClass());
7475

@@ -141,6 +142,11 @@ public SuccessOrFailure<Proxy> startProxy(Proxy proxy) throws ContainerProxyExce
141142

142143
}
143144

145+
@Override
146+
public String getContainerImage(Container container) {
147+
return (String) container.getParameters().get(PARAM_CONTAINER_IMAGE);
148+
}
149+
144150
protected void doStartProxy(Proxy proxy) throws Exception {
145151
for (ContainerSpec spec: proxy.getSpec().getContainerSpecs()) {
146152
if (authBackend != null) authBackend.customizeContainer(spec);
@@ -153,6 +159,7 @@ protected void doStartProxy(Proxy proxy) throws Exception {
153159

154160
Container c = startContainer(eSpec, proxy);
155161
c.setSpec(spec);
162+
c.getParameters().put(PARAM_CONTAINER_IMAGE, eSpec.getImage());
156163

157164
proxy.getContainers().add(c);
158165
}

src/main/java/eu/openanalytics/containerproxy/backend/IContainerBackend.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public interface IContainerBackend {
5252
* @throws ContainerProxyException If the startup fails for any reason.
5353
*/
5454
public SuccessOrFailure<Proxy> startProxy(Proxy proxy) throws ContainerProxyException;
55-
55+
5656
/**
5757
* Stop the given proxy. Any resources used by the proxy should be released.
5858
*
@@ -88,4 +88,6 @@ public interface IContainerBackend {
8888
* @param portBindings The portbindings of this container, as generated by the scanExistingContainers method.
8989
*/
9090
public void setupPortMappingExistingProxy(Proxy proxy, Container container, Map<Integer, Integer> portBindings) throws Exception;
91+
92+
public String getContainerImage(Container container);
9193
}

0 commit comments

Comments
 (0)