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

logs cause exception with non-ascii characters #187

Closed
tgermain opened this issue Apr 11, 2017 · 0 comments
Closed

logs cause exception with non-ascii characters #187

tgermain opened this issue Apr 11, 2017 · 0 comments

Comments

@tgermain
Copy link

#How to reproduce
Create an app with non-ascii character in labels for exemple :

{
  "id": "nonascii",
  "mem": 32.0,
  "cpus": 0.5,                   
  "instances": 1,
  "labels": {
    "nonascii":"ççççç"
  },
  "container": { 
    "docker": {
      "portMappings": [
        {
          "servicePort": 0,
          "protocol": "tcp",
          "containerPort": 443,
          "hostPort": 0
        },
        {
          "servicePort": 0,
          "protocol": "tcp",
          "containerPort": 80,
          "hostPort": 0
        }
      ], 
      "image": "nginx",
      "network": "BRIDGE",       
      "priviledged": false
    },
    "type": "DOCKER",
    "volumes": []
  },
  "healthChecks": []
}

If you try to use get_apps() you will raise an exception : UnicodeEncodeError: 'ascii' codec can't encode characters in position 95-96: ordinal not in range(128)

The tricky part is that the actual call to marathon achieve through requests here succeed. But if response.text contains any non-ascii char, this call :

marathon.log.error('Got HTTP {code}: {body}'.format(
code=response.status_code, body=response.text))

will fail.

See logs starting form here : https://github.com/thefactory/marathon-python/blob/master/marathon/client.py#L93

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

1 participant