diff --git a/imageroot/actions/delete-route/21file b/imageroot/actions/delete-route/20file similarity index 86% rename from imageroot/actions/delete-route/21file rename to imageroot/actions/delete-route/20file index 0438cf3..842aeab 100755 --- a/imageroot/actions/delete-route/21file +++ b/imageroot/actions/delete-route/20file @@ -14,5 +14,5 @@ from pathlib import Path data = json.load(sys.stdin) # Remove route configuration -p = Path(f'configs/{data["instance"]}-route.yml') +p = Path(f'configs/{data["instance"]}.yml') p.unlink(missing_ok=True) diff --git a/imageroot/actions/delete-route/20writeconfig b/imageroot/actions/delete-route/20writeconfig deleted file mode 100755 index e7e914d..0000000 --- a/imageroot/actions/delete-route/20writeconfig +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env python3 - -# -# Copyright (C) 2021 Nethesis S.r.l. -# http://www.nethesis.it - nethserver@nethesis.it -# -# This script is part of NethServer. -# -# NethServer is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, -# or any later version. -# -# NethServer is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with NethServer. If not, see COPYING. -# - -# -# Delete traefik virtual host -# Input example: -# -# {"instance": "module1"} -# - -import json -import sys -import os -import agent - -# Try to parse the stdin as JSON. -# If parsing fails, output everything to stderr -data = json.load(sys.stdin) - -agent_id = os.getenv("AGENT_ID", "") -if not agent_id: - raise Exception("AGENT_ID not found inside the environemnt") - -# Connect to redis -r = agent.redis_connect(privileged=True).pipeline() - -# Prepare common key prefix -prefix=f'{agent_id}/kv/http' -router=f'{prefix}/routers/{data["instance"]}-http' -router_s=f'{prefix}/routers/{data["instance"]}-https' -middlewares=f'{prefix}/middlewares' - -# Setup HTTP ans HTTPS routers -r.delete(f'{prefix}/services/{data["instance"]}/loadBalancer/servers/0/url') -r.delete(f'{router}/service') -r.delete(f'{router}/entrypoints') -r.delete(f'{router}/rule') -r.delete(f'{router}/priority') -r.delete(f'{router_s}/entrypoints') -r.delete(f'{router_s}/rule') -r.delete(f'{router_s}/priority') -r.delete(f'{router_s}/tls') -r.delete(f'{router_s}/service') -r.delete(f'{router_s}/tls/domains/0/main') -r.delete(f'{router_s}/tls/certresolver') -r.delete(f'{router}/middlewares/0') -r.delete(f'{router}/middlewares/1') -r.delete(f'{router}/middlewares/20') -r.delete(f'{router}/middlewares/30') -r.delete(f'{router_s}/middlewares/1') -r.delete(f'{router_s}/middlewares/20') -r.delete(f'{router_s}/middlewares/30') -r.delete(f'{middlewares}/{data["instance"]}-stripprefix/stripPrefix/prefixes/0') -r.delete(f'{middlewares}/{data["instance"]}-auth/forwardAuth/address') -r.delete(f'{middlewares}/{data["instance"]}-auth/forwardAuth/tls/insecureSkipVerify') - -# Write the configuration on redis -r.execute()