You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by kl...@apache.org on 2018/10/15 11:40:32 UTC
[mesos] 02/02: Added try/catch statements when using Mesos util
functions in new CLI.
This is an automated email from the ASF dual-hosted git repository.
klueska pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
commit 3b8be5a17ad9ce9e981ddc2c0789c37af1700de0
Author: Armand Grillet <ag...@mesosphere.io>
AuthorDate: Mon Oct 15 07:36:27 2018 -0400
Added try/catch statements when using Mesos util functions in new CLI.
Review: https://reviews.apache.org/r/68965/
---
src/python/cli_new/lib/cli/plugins/agent/main.py | 8 +++++++-
src/python/cli_new/lib/cli/plugins/task/main.py | 8 +++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/python/cli_new/lib/cli/plugins/agent/main.py b/src/python/cli_new/lib/cli/plugins/agent/main.py
index 5e821b3..4a658f9 100644
--- a/src/python/cli_new/lib/cli/plugins/agent/main.py
+++ b/src/python/cli_new/lib/cli/plugins/agent/main.py
@@ -57,7 +57,13 @@ class Agent(PluginBase):
raise CLIException("Unable to get leading master address: {error}"
.format(error=exception))
- agents = get_agents(master)
+ try:
+ agents = get_agents(master)
+ except Exception as exception:
+ raise CLIException("Unable to get agents from leading"
+ " master '{master}': {error}"
+ .format(master=master, error=exception))
+
if not agents:
print("The cluster does not have any agents.")
return
diff --git a/src/python/cli_new/lib/cli/plugins/task/main.py b/src/python/cli_new/lib/cli/plugins/task/main.py
index a47a8c5..8a4a859 100644
--- a/src/python/cli_new/lib/cli/plugins/task/main.py
+++ b/src/python/cli_new/lib/cli/plugins/task/main.py
@@ -56,7 +56,13 @@ class Task(PluginBase):
raise CLIException("Unable to get leading master address: {error}"
.format(error=exception))
- tasks = get_tasks(master)
+ try:
+ tasks = get_tasks(master)
+ except Exception as exception:
+ raise CLIException("Unable to get tasks from leading"
+ " master '{master}': {error}"
+ .format(master=master, error=exception))
+
if not tasks:
print("There are no tasks running in the cluster.")
return