def get(self): self.set_header('Access-Control-Allow-Origin', '*') try: container = ARContainerManager.get_container_name(self. get_argument_value('container')) containers_names = ARContainerManager.get_all_containers_names() if container in containers_names: ar_service_manager = ARServiceManager(container) results = ar_service_manager.list() import json self.write(json.dumps(results)) else: raise ARContainerException(ContainerStatusPool.ID_CONTAINER_DOES_NOT_EXIST) except Exception as e: self.set_status(202) raise e
def get(self): self.set_header('Access-Control-Allow-Origin', '*') try: import json self.write(json.dumps(ARServiceManager.all())) except Exception as e: self.set_status(202) raise e
def execute(command, service=None, container=None): if command == 'list': if container is not None and service is None: container = ARContainerManager.get_container_name(container) print ARServiceManager(container).list() else: print ARContainerManager().list() elif command == 'status': if container is not None and service is None: print ARContainerManager().status(container) elif container is not None and service is not None: print ARServiceManager(container).status(service) elif command == 'start': if container is not None and service is None: print ARContainerManager().start(container) elif container is not None and service is not None: print ARServiceManager(container).start(service) elif command == 'stop': if container is not None and service is None: print ARContainerManager().stop(container) elif container is not None and service is not None: print ARServiceManager(container).stop(service) elif command == 'restart': if container is not None and service is None: print ARContainerManager().restart(container) elif container is not None and service is not None: print ARServiceManager(container).restart(service) elif command == 'stats': if container is not None and service is None: print ARContainerManager().stats(container) elif container is not None and service is not None: print ARServiceManager(container).stats(service) elif command == 'version': print ARVersionManager().get_all_version()