Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2cb1c23

Browse files
committedMay 27, 2024·
reverse-proxy: T6409: Remove unused backend parameters
1 parent 48e5266 commit 2cb1c23

File tree

4 files changed

+52
-13
lines changed

4 files changed

+52
-13
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<!-- include start from include/version/reverseproxy-version.xml.i -->
2+
<syntaxVersion component='reverse-proxy' version='1'></syntaxVersion>
3+
<!-- include end -->

‎interface-definitions/load-balancing_reverse-proxy.xml.in

-13
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,6 @@
9292
#include <include/generic-description.xml.i>
9393
#include <include/haproxy/mode.xml.i>
9494
#include <include/haproxy/http-response-headers.xml.i>
95-
<node name="parameters">
96-
<properties>
97-
<help>Backend parameters</help>
98-
</properties>
99-
<children>
100-
<leafNode name="http-check">
101-
<properties>
102-
<help>HTTP health check</help>
103-
<valueless/>
104-
</properties>
105-
</leafNode>
106-
</children>
107-
</node>
10895
<node name="http-check">
10996
<properties>
11097
<help>HTTP check configuration</help>

‎interface-definitions/xml-component-version.xml.in

+1
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,5 @@
4848
#include <include/version/vyos-accel-ppp-version.xml.i>
4949
#include <include/version/wanloadbalance-version.xml.i>
5050
#include <include/version/webproxy-version.xml.i>
51+
#include <include/version/reverseproxy-version.xml.i>
5152
</interfaceDefinition>
+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/usr/bin/env python3
2+
#
3+
# Copyright (C) 2024 VyOS maintainers and contributors
4+
#
5+
# This program is free software; you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License version 2 or later as
7+
# published by the Free Software Foundation.
8+
#
9+
# This program is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License
15+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
17+
# combine both sip-server-address and sip-server-name nodes to common sip-server
18+
19+
from sys import argv, exit
20+
from vyos.configtree import ConfigTree
21+
22+
if len(argv) < 2:
23+
print("Must specify file name!")
24+
exit(1)
25+
26+
file_name = argv[1]
27+
28+
with open(file_name, 'r') as f:
29+
config_file = f.read()
30+
31+
config = ConfigTree(config_file)
32+
base = ['load-balancing', 'reverse-proxy', 'backend']
33+
if not config.exists(base):
34+
# Nothing to do
35+
exit(0)
36+
else:
37+
# we need to run this for every configured network
38+
for backend in config.list_nodes(base):
39+
param_node = base + [backend, 'parameters']
40+
if config.exists(param_node):
41+
config.delete(param_node)
42+
43+
try:
44+
with open(file_name, 'w') as f:
45+
f.write(config.to_string())
46+
except OSError as e:
47+
print("Failed to save the modified config: {}".format(e))
48+
exit(1)

0 commit comments

Comments
 (0)
Please sign in to comment.