Radoslaw Gruchalski created MESOS-3556:
------------------------------------------

             Summary: mesos.cli broken in 0.24.0+
                 Key: MESOS-3556
                 URL: https://issues.apache.org/jira/browse/MESOS-3556
             Project: Mesos
          Issue Type: Bug
          Components: cli
    Affects Versions: 0.24.1, 0.24.0
            Reporter: Radoslaw Gruchalski


The issue was initially reported on the mailing list: 
http://www.mail-archive.com/[email protected]/msg04670.html

The format of the master data stored in zookeeper has changed but the mesos.cli 
does not reflect these changes causing tools like {{mesos-tail}} and 
{{mesos-ps}} to fail.

Example error from {{mesos-tail}}:

{noformat}
mesos-master ~$ mesos tail -f -n 50 service
Traceback (most recent call last):
  File "/usr/local/bin/mesos-tail", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/mesos/cli/cli.py", line 61, in 
wrapper
    return fn(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/mesos/cli/cmds/tail.py", line 
55, in main
    args.task, args.file, fail=(not args.follow)):
  File "/usr/local/lib/python2.7/dist-packages/mesos/cli/cluster.py", line 27, 
in files
    tlist = MASTER.tasks(fltr)
  File "/usr/local/lib/python2.7/dist-packages/mesos/cli/master.py", line 174, 
in tasks
    self._task_list(active_only))))
  File "/usr/local/lib/python2.7/dist-packages/mesos/cli/master.py", line 153, 
in _task_list
    *[util.merge(x, *keys) for x in self.frameworks(active_only)])
  File "/usr/local/lib/python2.7/dist-packages/mesos/cli/master.py", line 185, 
in frameworks
    return util.merge(self.state, *keys)
  File "/usr/local/lib/python2.7/dist-packages/mesos/cli/util.py", line 58, in 
__get__
    value = self.fget(inst)
  File "/usr/local/lib/python2.7/dist-packages/mesos/cli/master.py", line 123, 
in state
    return self.fetch("/master/state.json").json()
  File "/usr/local/lib/python2.7/dist-packages/mesos/cli/master.py", line 64, 
in fetch
    return requests.get(urlparse.urljoin(self.host, url), **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 69, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 50, in 
request
    response = session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 451, 
in request
    prep = self.prepare_request(req)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 382, 
in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 304, 
in prepare
    self.prepare_url(url, params)
  File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 357, 
in prepare_url
    raise InvalidURL(*e.args)
requests.exceptions.InvalidURL: Failed to parse: 
10.100.1.100:5050","port":5050,"version":"0.24.1"}
{noformat}

The problem exists in 
https://github.com/mesosphere/mesos-cli/blob/master/mesos/cli/master.py#L107. 
The code should be along the lines of:

{noformat}
            try:
                parsed =  json.loads(val)
                return parsed["address"]["ip"] + ":" + 
str(parsed["address"]["port"])
            except Exception:
                return val.split("@")[-1]
{noformat}

This causes the master address to come back correctly.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to