andreaspeters commented on a change in pull request #413: URL: https://github.com/apache/mesos/pull/413#discussion_r740082897
########## File path: src/python/cli_new/lib/cli/plugins/framework/main.py ########## @@ -0,0 +1,120 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +The framework plugin. +""" + +import json + +from cli.exceptions import CLIException +from cli.mesos import get_frameworks +from cli.plugins import PluginBase +from cli.util import Table + + +PLUGIN_NAME = "framework" +PLUGIN_CLASS = "Framework" + +VERSION = "v0.1.0" + +SHORT_HELP = "Interacts with the Mesos Frameworks" + + +class Framework(PluginBase): + """ + The framework plugin. + """ + + COMMANDS = { + "list": { + "arguments": [], + "flags": { + "-a --all": "list also non active frameworks" + }, + "short_help": "List the Mesos frameworks.", + "long_help": "List information about the Mesos frameworks." + }, + "inspect": { + "arguments": ['<framework_id>'], + "flags": {}, + "short_help": "Return low-level information of the framework.", + "long_help": "Return low-level information of the framework." + } + } + + def list(self, argv): + """ + Show a list of running M3s frameworks + """ + + try: + master = self.config.master() + config = self.config + except Exception as exception: + raise CLIException("Unable to get leading master address: {error}" + .format(error=exception)) + + data = get_frameworks(master, config) + try: Review comment: Theoretically nothing. Because, if data include an item therefore it will go into the loop, then framework["<key>"] should also be set. Even if it's empty (because of whatever reason :man_shrugging:). I can remove it, what do u think? -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
