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" }
def prune_networks(self, configs={}): _network = Network_Module() if _network.set_host(configs["host_id"]).check_health(): print(_network.prune())