Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DockerAccessWithHcClient.inspectContainer throws DockerAccessException #566

Closed
danielwegener opened this issue Sep 26, 2016 · 4 comments
Closed

Comments

@danielwegener
Copy link
Contributor

danielwegener commented Sep 26, 2016

In Version 0.16.3:

DockerAccessWithHcClient.inspectContainer never returns null if a container can not be found (as suggested by the javadoc of DockerAccess) but rather throws an DockerAccessException(e, "Unable to retrieve container name for [%s]). This is harmful when io/fabric8/maven/docker/util/StartOrderResolver.java:127 tries to look for existing externally linked containers via io.fabric8.maven.docker.service.QueryService#hasContainer (It ends up in Cannot resolve image dependencies for start order messages) whenever the start order resolver checks for external containers.

DockerAccessWithHcClient.inspecContainer should rather expect 404s and return null if encountered as in

String response = delegate.get(url, HTTP_OK, HTTP_NOT_FOUND);
return (response == null)? null : new ContainerDetails(new JSONObject(response));

and the ApacheHttpClientDelegate should maybe translate 404 responses into nulls.

Unfortunately I see no configuration workaround to get around this

@rhuss
Copy link
Collaborator

rhuss commented Sep 26, 2016

I consider this a bug and will make the change you suggest. All other methods also have the same semantics that null means 'not-found'.

@rhuss rhuss closed this as completed in c81bfcd Sep 26, 2016
rhuss added a commit that referenced this issue Sep 26, 2016
Which now checks for the return status code.
@martinborisov87
Copy link

Hi, I still have a problem with that.
I have a docker:stop in my "pre-integration-test" phase in order to stop containers just in case they are still running.
Before this fix I was getting "Unable to retrieve container name for [%s]" if the container was not existing, but now I am getting a really strange one - "Failed to execute goal io.fabric8:docker-maven-plugin:0.16.4:stop (stop-before-test) on project: Execution stop-before-test of goal io.fabric8:docker-maven-plugin:0.16.4:stop failed: A JSONObject text must begin with '{' at 1 [character
2 line 1] -> [Help 1]"

I didn't have any problems with the previous plugin versions. I decided to update the version, because I needed to use the "network" feature, introduced later.

Thanks

@rhuss
Copy link
Collaborator

rhuss commented Sep 27, 2016

@martinborisov87 which version of the plugin are you using ? If its 0.16.4 then this should be fixed this evening when I release 0.16.5

@martinborisov87
Copy link

Yes, it is 0.16.4. Perfect, I'll wait for the new version then. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants