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

when run list_apps ,has errors #99

Closed
houht opened this issue May 9, 2016 · 5 comments · Fixed by #101
Closed

when run list_apps ,has errors #99

houht opened this issue May 9, 2016 · 5 comments · Fixed by #101

Comments

@houht
Copy link

houht commented May 9, 2016

from marathon import MarathonClient
c = MarathonClient('http://10.0.2.47:8090')
c.list_apps()

_Traceback (most recent call last):
File "", line 1, in
File "marathon/client.py", line 165, in list_apps
response, MarathonApp, is_list=True, resource_name='apps')
File "marathon/client.py", line 48, in parse_response
return [clazz.from_json(resource) for resource in target]
File "marathon/models/base.py", line 35, in from_json
return cls({to_snake_case(k): v for k, v in attributes.items()})
File "marathon/models/app.py", line 103, in init
else MarathonContainer.from_json(container)
File "marathon/models/base.py", line 35, in from_json
return cls(
{to_snake_case(k): v for k, v in attributes.items()})
File "marathon/models/container.py", line 26, in init
else MarathonDockerContainer().from_json(docker)
File "marathon/models/base.py", line 35, in from_json
return cls({to_snake_case(k): v for k, v in attributes.items()})
File "marathon/models/container.py", line 64, in init
for pm in (port_mappings or [])
File "marathon/models/base.py", line 35, in from_json
return cls(
{to_snake_case(k): v for k, v in attributes.items()})
TypeError: init() got an unexpected keyword argument 'name'

@houht
Copy link
Author

houht commented May 9, 2016

*Environment:
*

marathon-1.1.1

marathon-python-0.8.1

Python 2.7.5

Linux 3.10.0-327.el7.x86_64

@solarkennedy
Copy link
Contributor

Huh. I guess we don't have an param for the name field in the port mapping model?

Can you pb the actual json that marathon returned? And if you feel adventurous to scratch your own itch, can you add a name parameter to that model so it can understand it?

@houht
Copy link
Author

houht commented May 10, 2016

Normal accessed through api:

curl http://10.0.2.47:8090/v2/apps

return:

{"apps":[{"id":"/mysqlt1","cmd":null,"args":null,"user":null,"env":{"MYSQL_ROOT_PASSWORD":"123456"},"instances":1,"cpus":1,"mem":256,"disk":300,"executor":"","constraints":[],"uris":[],"fetch":[],"storeUrls":[],"ports":[4406],"portDefinitions":[{"port":4406,"protocol":"tcp","labels":{}}],"requirePorts":false,"backoffSeconds":1,"backoffFactor":1.15,"maxLaunchDelaySeconds":3600,"container":{"type":"DOCKER","volumes":[],"docker":{"image":"mysql:5.6","network":"BRIDGE","portMappings":[{"containerPort":3306,"hostPort":0,"servicePort":4406,"protocol":"tcp","name":"mysqlport","labels":{}}],"privileged":false,"parameters":[],"forcePullImage":false}},"healthChecks":[],"readinessChecks":[],"dependencies":[],"upgradeStrategy":{"minimumHealthCapacity":1,"maximumOverCapacity":1},"labels":{},"acceptedResourceRoles":null,"ipAddress":null,"version":"2016-05-09T08:03:27.589Z","residency":null,"versionInfo":{"lastScalingAt":"2016-05-09T08:03:27.589Z","lastConfigChangeAt":"2016-04-29T09:46:13.648Z"},"tasksStaged":1,"tasksRunning":0,"tasksHealthy":0,"tasksUnhealthy":0,"deployments":[]},{"id":"/myapp3","cmd":"sleep 100","args":null,"user":null,"env":{},"instances":2,"cpus":1,"mem":16,"disk":0,"executor":"","constraints":[],"uris":[],"fetch":[],"storeUrls":[],"ports":[10000],"portDefinitions":[{"port":10000,"protocol":"tcp","labels":{}}],"requirePorts":false,"backoffSeconds":1,"backoffFactor":1.15,"maxLaunchDelaySeconds":3600,"container":null,"healthChecks":[],"readinessChecks":[],"dependencies":[],"upgradeStrategy":{"minimumHealthCapacity":1,"maximumOverCapacity":1},"labels":{},"acceptedResourceRoles":null,"ipAddress":null,"version":"2016-05-09T09:54:52.749Z","residency":null,"versionInfo":{"lastScalingAt":"2016-05-09T09:54:52.749Z","lastConfigChangeAt":"2016-05-09T09:52:03.943Z"},"tasksStaged":0,"tasksRunning":2,"tasksHealthy":0,"tasksUnhealthy":0,"deployments":[]}]}

@houht
Copy link
Author

houht commented May 10, 2016

May be the reason:

MarathonMinimalJsonEncoder

@houht
Copy link
Author

houht commented May 12, 2016

Thank you, the problem has been resolved

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

Successfully merging a pull request may close this issue.

2 participants