def check_status(self): client = ApiClient(self.console.core_url) status = client.check_status() if status['status'] == 'Live': return True else: print 'No connection to server. Check url.' return False
def execute(self, params=None): client = ApiClient(self.console.core_url) status = client.check_status() print 'Configured server: ', self.console.core_url print 'Connection status: ', status['status'] print 'Server running : ', status['enabled'] print 'Modules enabled :' for mod in status['modules']: print '\t {}'.format(mod)
def check_status(self, state): client = ApiClient(self.console.core_url) status = client.check_status() if status['status'] != 'Live': print 'No connection to server' return False elif status['enabled'] and not state: print 'Server is already running' return False elif not status['enabled'] and state: print 'Server is not running' return False else: return True
def new_server_connection(self): client = ApiClient(self.core_url) if client.check_status()['status'] == 'Live': self.cmd_handlers['use'].reload()
def reload(self): client = ApiClient(self.console.core_url) self.modules = client.list_modules() print 'Just reloaded module list: {}'.format(self.modules)
def execute(self, params=None): if self.check_status(): client = ApiClient(self.console.core_url) for name in params: client.remove_module(name)
def send_start_request(self): print 'Requesting server to start..' client = ApiClient(self.console.core_url) client.request_start()