예제 #1
0
def prune_unused_networks(host_id):
    try:
        _network = Network_Module()

        if not _network.set_host(host_id).check_health():
            return {
                "status": "failed",
                "result": {
                    "error": _("Error, Unable to connect to docker host!")
                },
                "notify_type": "failed"
            }

        result = _network.prune()

        if result:
            return {
                "status": "passed",
                "result": "{}",
                "notify_type": "passed"
            }
        else:
            return {
                "status": "failed",
                "result": "{}",
                "notify_type": "failed"
            }
    except Exception as e:
        return {
            "status": "error",
            "result": {
                "error": str(e)
            },
            "notify_type": "error"
        }
예제 #2
0
파일: host.py 프로젝트: megamcloud/Kraven
 def prune_networks(self, configs={}):
     _network = Network_Module()
     if _network.set_host(configs["host_id"]).check_health():
         print(_network.prune())