ArmandGrillet commented on a change in pull request #345: Allow `mesos task
exec/attach` for any task_id
URL: https://github.com/apache/mesos/pull/345#discussion_r338907494
##########
File path: src/python/cli_new/lib/cli/mesos.py
##########
@@ -114,25 +114,25 @@ def get_container_id(task):
" Please try again.")
-def get_tasks(master):
+def get_tasks(master, query=None):
"""
Get the tasks in a Mesos cluster.
"""
endpoint = "tasks"
key = "tasks"
try:
- data = http.get_json(master, endpoint)
+ data = http.get_json(master, endpoint, query)
except Exception as exception:
raise CLIException(
- "Could not open '/{endpoint}' on master: {error}"
- .format(endpoint=endpoint, error=exception))
+ "Could not open '/{endpoint}' with query: {query} on master:
{error}"
+ .format(endpoint=endpoint, query=query, error=exception))
Review comment:
This would print `"Could not open '/tasks' with query: None on master: error
message"` if `query` is `None`.
I think it would be cleaner to print `"Could not open '/tasks' with query:
{} on master: error message"`, `"Could not open '/tasks' with query parameters:
None on master: error message"`, or `"Could not open '/tasks' on master: error
message"` if there is no query.
This would require to check for the content of query before raising the
exception.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services