Docker plugin name conflict with docker library

Bug #1297122 reported by Chmouel Boudjnah
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Invalid
Undecided
Chmouel Boudjnah

Bug Description

The docker plugin is conflicting with the 'docker' library, that would not be a problem if the plugin wasn't used but while trying to fix bugs 1296758 since I needed to use docker.APIError, the unittests would fail as seen below, I would advise to rename the module to docker_plugin or something like that.

creating DockerContainer "Blog" Stack "test_stack" [e653e6fa-c4ec-4114-87ae-88cf9c3c544c]
Task create from DockerContainer "Blog" Stack "test_stack" [e653e6fa-c4ec-4114-87ae-88cf9c3c544c] running
Task create from DockerContainer "Blog" Stack "test_stack" [e653e6fa-c4ec-4114-87ae-88cf9c3c544c] running
Task create from DockerContainer "Blog" Stack "test_stack" [e653e6fa-c4ec-4114-87ae-88cf9c3c544c] complete
Task delete from DockerContainer "Blog" [epurnyslrtljryxprtzdafhwopyodlvg] Stack "test_stack" [e653e6fa-c4ec-4114-87ae-88cf9c3c544c] starting
Task delete from DockerContainer "Blog" [epurnyslrtljryxprtzdafhwopyodlvg] Stack "test_stack" [e653e6fa-c4ec-4114-87ae-88cf9c3c544c] running
deleting DockerContainer "Blog" [epurnyslrtljryxprtzdafhwopyodlvg] Stack "test_stack" [e653e6fa-c4ec-4114-87ae-88cf9c3c544c]
Delete DockerContainer "Blog" [epurnyslrtljryxprtzdafhwopyodlvg] Stack "test_stack" [e653e6fa-c4ec-4114-87ae-88cf9c3c544c]
Traceback (most recent call last):
  File "heat/engine/resource.py", line 683, in delete
    handle_data = self.handle_delete()
  File "/opt/stack/heat/contrib/docker/docker/resources/docker_container.py", line 253, in handle_delete
    except docker.APIError:
AttributeError: 'module' object has no attribute 'APIError'
}}}

Traceback (most recent call last):
  File "/opt/stack/heat/contrib/docker/docker/tests/test_docker_container.py", line 108, in test_resource_delete_even_when_not_here
    scheduler.TaskRunner(container.delete)()
  File "heat/engine/scheduler.py", line 140, in __call__
    self.start(timeout=timeout)
  File "heat/engine/scheduler.py", line 161, in start
    self.step()
  File "heat/engine/scheduler.py", line 189, in step
    next(self._runner)
  File "heat/engine/resource.py", line 699, in delete
    raise failure
ResourceFailure: AttributeError: 'module' object has no attribute 'APIError'
Ran 5 tests in 0.805s
FAILED (id=0, failures=1)
error: testr failed (1)
ERROR: InvocationError: '/opt/stack/heat/.tox/py27/bin/python setup.py testr --slowest --testr-args=test_docker_container'
________________________________________________________________________ summary __________________________________________

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

Fix proposed to branch: master
Review: https://review.openstack.org/82730

Changed in heat:
assignee: nobody → Chmouel Boudjnah (chmouel)
status: New → In Progress
Revision history for this message
Thomas Herve (therve) wrote :

Why does it work with docker.Client and not docker.APIError?

Revision history for this message
Chmouel Boudjnah (chmouel) wrote :

it only happen during unittest. tox/testr/nosetests gets docker into the path when running the unittests but not during initialisation.

docker.Client wasn't imported on unittests since there is a fake_client that completely bypass it (which i don't think it's right but that's an another subject)

Since I need to catch docker api exceptions to test if the stack was not existing I can't just fake it and need to use directly docker.APIError

Revision history for this message
Jason Dunsmore (jasondunsmore) wrote :

Can you give instructions on how to reproduce the bug?

Changed in heat:
status: In Progress → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.