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

portMapping isn't iterable #25

Closed
graovic opened this issue Mar 27, 2015 · 1 comment
Closed

portMapping isn't iterable #25

graovic opened this issue Mar 27, 2015 · 1 comment

Comments

@graovic
Copy link

graovic commented Mar 27, 2015

Hi,

I think you have a bug in MarathonContainerPortMapping class. Object generated from this class isn't iterable so bug is shown when you try to build docker container from this client. First MarathonContainerPortMapping doesn't returning iterator ,and second maybe it's better to this object (from class MarathonContainerPortMapping) contains list of PortMapping objects that contains container_port=, host_port=, service_port=, protocol'. And of course returning these elements through iterator.

from marathon import MarathonClient
from marathon.models.container import MarathonContainer
from marathon.models.container import MarathonDockerContainer
from marathon.models.container import MarathonContainerPortMapping
from marathon.models.container import MarathonContainerVolume
c = MarathonClient("localhost:8080")
portMapping = MarathonContainerPortMapping(container_port=80, host_port=0, service_port=1822, protocol='tcp')
docker = MarathonDockerContainer(image="ppoint/cmsv2", network="BRIDGE", port_mappings=portMapping)
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/site-packages/marathon/models/container.py", line 56, in init
for pm in (port_mappings or [])
TypeError: 'MarathonContainerPortMapping' object is not iterable

python --version
Python 2.7.5

@graovic
Copy link
Author

graovic commented Mar 27, 2015

Sorry, everything is fine. MarathonDockerContainer needs port_mappings inside of list. You can close this issue.

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

2 participants