summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2024-06-06 10:51:33 -0500
committerGitHub <noreply@github.com>2024-06-06 10:51:33 -0500
commite3a04ea99108a2c4fbe1f95e93621fbf81bf750d (patch)
tree6072ecb5f2f6ab1629a0141e5d7df453fed241b2
parent7a0d80e11326622021e1b282df0d3aac0b233ba1 (diff)
parent61f8250184e927de9ab6bddc207b917bef7da42b (diff)
downloadvyos-1x-e3a04ea99108a2c4fbe1f95e93621fbf81bf750d.tar.gz
vyos-1x-e3a04ea99108a2c4fbe1f95e93621fbf81bf750d.zip
Merge pull request #3589 from natali-rs1985/T6423-current
xml: T6423: enforce priority on nodes having an owner
-rw-r--r--interface-definitions/load-balancing_reverse-proxy.xml.in1
-rw-r--r--interface-definitions/load-balancing_wan.xml.in2
-rw-r--r--interface-definitions/protocols_static_arp.xml.in1
-rw-r--r--interface-definitions/protocols_static_multicast.xml.in1
-rw-r--r--interface-definitions/protocols_static_neighbor-proxy.xml.in1
-rw-r--r--interface-definitions/service_aws_glb.xml.in2
-rw-r--r--interface-definitions/service_config-sync.xml.in1
-rw-r--r--interface-definitions/service_console-server.xml.in1
-rw-r--r--interface-definitions/service_event-handler.xml.in1
-rw-r--r--interface-definitions/service_monitoring_telegraf.xml.in2
-rw-r--r--interface-definitions/service_monitoring_zabbix-agent.xml.in1
-rw-r--r--interface-definitions/service_sla.xml.in1
-rw-r--r--interface-definitions/system_login_banner.xml.in1
-rw-r--r--interface-definitions/system_proxy.xml.in1
-rwxr-xr-xscripts/build-command-templates12
15 files changed, 25 insertions, 4 deletions
diff --git a/interface-definitions/load-balancing_reverse-proxy.xml.in b/interface-definitions/load-balancing_reverse-proxy.xml.in
index ce757a5d6..1a432be6d 100644
--- a/interface-definitions/load-balancing_reverse-proxy.xml.in
+++ b/interface-definitions/load-balancing_reverse-proxy.xml.in
@@ -5,6 +5,7 @@
<node name="reverse-proxy" owner="${vyos_conf_scripts_dir}/load-balancing_reverse-proxy.py">
<properties>
<help>Configure reverse-proxy</help>
+ <priority>900</priority>
</properties>
<children>
<tagNode name="service">
diff --git a/interface-definitions/load-balancing_wan.xml.in b/interface-definitions/load-balancing_wan.xml.in
index e117fd1b2..310aa0343 100644
--- a/interface-definitions/load-balancing_wan.xml.in
+++ b/interface-definitions/load-balancing_wan.xml.in
@@ -3,12 +3,12 @@
<node name="load-balancing">
<properties>
<help>Configure load-balancing</help>
- <priority>900</priority>
</properties>
<children>
<node name="wan" owner="${vyos_conf_scripts_dir}/load-balancing_wan.py">
<properties>
<help>Configure Wide Area Network (WAN) load-balancing</help>
+ <priority>900</priority>
</properties>
<children>
<leafNode name="disable-source-nat">
diff --git a/interface-definitions/protocols_static_arp.xml.in b/interface-definitions/protocols_static_arp.xml.in
index 05c69f1ed..0c5d6e4ed 100644
--- a/interface-definitions/protocols_static_arp.xml.in
+++ b/interface-definitions/protocols_static_arp.xml.in
@@ -7,6 +7,7 @@
<node name="arp" owner="${vyos_conf_scripts_dir}/protocols_static_arp.py">
<properties>
<help>Static ARP translation</help>
+ <priority>481</priority>
</properties>
<children>
<tagNode name="interface">
diff --git a/interface-definitions/protocols_static_multicast.xml.in b/interface-definitions/protocols_static_multicast.xml.in
index c8e28ed35..caf95ed7c 100644
--- a/interface-definitions/protocols_static_multicast.xml.in
+++ b/interface-definitions/protocols_static_multicast.xml.in
@@ -7,6 +7,7 @@
<node name="multicast" owner="${vyos_conf_scripts_dir}/protocols_static_multicast.py">
<properties>
<help>Multicast static route</help>
+ <priority>481</priority>
</properties>
<children>
<tagNode name="route">
diff --git a/interface-definitions/protocols_static_neighbor-proxy.xml.in b/interface-definitions/protocols_static_neighbor-proxy.xml.in
index 1c8433a39..7347976f9 100644
--- a/interface-definitions/protocols_static_neighbor-proxy.xml.in
+++ b/interface-definitions/protocols_static_neighbor-proxy.xml.in
@@ -7,6 +7,7 @@
<node name="neighbor-proxy" owner="${vyos_conf_scripts_dir}/protocols_static_neighbor-proxy.py">
<properties>
<help>Neighbor proxy parameters</help>
+ <priority>481</priority>
</properties>
<children>
<tagNode name="arp">
diff --git a/interface-definitions/service_aws_glb.xml.in b/interface-definitions/service_aws_glb.xml.in
index c749fd04e..71de1f03a 100644
--- a/interface-definitions/service_aws_glb.xml.in
+++ b/interface-definitions/service_aws_glb.xml.in
@@ -5,12 +5,12 @@
<node name="aws">
<properties>
<help>Amazon Web Service</help>
- <priority>1280</priority>
</properties>
<children>
<node name="glb" owner="${vyos_conf_scripts_dir}/service_aws_glb.py">
<properties>
<help>Gateway load-balancer tunnel handler</help>
+ <priority>1280</priority>
</properties>
<children>
<node name="script">
diff --git a/interface-definitions/service_config-sync.xml.in b/interface-definitions/service_config-sync.xml.in
index 648c14aee..af4e8ed51 100644
--- a/interface-definitions/service_config-sync.xml.in
+++ b/interface-definitions/service_config-sync.xml.in
@@ -5,6 +5,7 @@
<node name="config-sync" owner="${vyos_conf_scripts_dir}/service_config-sync.py">
<properties>
<help>Configuration synchronization</help>
+ <priority>10000</priority>
</properties>
<children>
<node name="secondary">
diff --git a/interface-definitions/service_console-server.xml.in b/interface-definitions/service_console-server.xml.in
index fc6dbe954..68835dafd 100644
--- a/interface-definitions/service_console-server.xml.in
+++ b/interface-definitions/service_console-server.xml.in
@@ -5,6 +5,7 @@
<node name="console-server" owner="${vyos_conf_scripts_dir}/service_console-server.py">
<properties>
<help>Serial Console Server</help>
+ <priority>2</priority>
</properties>
<children>
<tagNode name="device">
diff --git a/interface-definitions/service_event-handler.xml.in b/interface-definitions/service_event-handler.xml.in
index 2cee4f595..41540816b 100644
--- a/interface-definitions/service_event-handler.xml.in
+++ b/interface-definitions/service_event-handler.xml.in
@@ -5,6 +5,7 @@
<node name="event-handler" owner="${vyos_conf_scripts_dir}/service_event-handler.py">
<properties>
<help>Service event handler</help>
+ <priority>2</priority>
</properties>
<children>
<tagNode name="event">
diff --git a/interface-definitions/service_monitoring_telegraf.xml.in b/interface-definitions/service_monitoring_telegraf.xml.in
index 4d694114a..2624023ea 100644
--- a/interface-definitions/service_monitoring_telegraf.xml.in
+++ b/interface-definitions/service_monitoring_telegraf.xml.in
@@ -5,12 +5,12 @@
<node name="monitoring">
<properties>
<help>Monitoring services</help>
- <priority>1280</priority>
</properties>
<children>
<node name="telegraf" owner="${vyos_conf_scripts_dir}/service_monitoring_telegraf.py">
<properties>
<help>Telegraf metric collector</help>
+ <priority>1280</priority>
</properties>
<children>
<node name="influxdb">
diff --git a/interface-definitions/service_monitoring_zabbix-agent.xml.in b/interface-definitions/service_monitoring_zabbix-agent.xml.in
index 40f2df642..3754e9145 100644
--- a/interface-definitions/service_monitoring_zabbix-agent.xml.in
+++ b/interface-definitions/service_monitoring_zabbix-agent.xml.in
@@ -7,6 +7,7 @@
<node name="zabbix-agent" owner="${vyos_conf_scripts_dir}/service_monitoring_zabbix-agent.py">
<properties>
<help>Zabbix-agent settings</help>
+ <priority>1280</priority>
</properties>
<children>
<leafNode name="directory">
diff --git a/interface-definitions/service_sla.xml.in b/interface-definitions/service_sla.xml.in
index 0c4f8a591..2cd68195a 100644
--- a/interface-definitions/service_sla.xml.in
+++ b/interface-definitions/service_sla.xml.in
@@ -5,6 +5,7 @@
<node name="sla" owner="${vyos_conf_scripts_dir}/service_sla.py">
<properties>
<help>Service level agreement (SLA)</help>
+ <priority>2</priority>
</properties>
<children>
<node name="owamp-server">
diff --git a/interface-definitions/system_login_banner.xml.in b/interface-definitions/system_login_banner.xml.in
index 211505ae4..c90e38c3c 100644
--- a/interface-definitions/system_login_banner.xml.in
+++ b/interface-definitions/system_login_banner.xml.in
@@ -11,6 +11,7 @@
<node name="banner" owner="${vyos_conf_scripts_dir}/system_login_banner.py">
<properties>
<help>System login banners</help>
+ <priority>410</priority>
</properties>
<children>
<leafNode name="post-login">
diff --git a/interface-definitions/system_proxy.xml.in b/interface-definitions/system_proxy.xml.in
index 214534dbb..5b0df5c70 100644
--- a/interface-definitions/system_proxy.xml.in
+++ b/interface-definitions/system_proxy.xml.in
@@ -5,6 +5,7 @@
<node name="proxy" owner="${vyos_conf_scripts_dir}/system_proxy.py">
<properties>
<help>Sets a proxy for system wide use</help>
+ <priority>100</priority>
</properties>
<children>
<leafNode name="url">
diff --git a/scripts/build-command-templates b/scripts/build-command-templates
index 2e7f8b994..36929abb2 100755
--- a/scripts/build-command-templates
+++ b/scripts/build-command-templates
@@ -287,6 +287,12 @@ def process_node(n, tmpl_dir):
props = get_properties(props_elem, n.find("defaultValue"))
if owner:
props["owner"] = owner
+ # <priority> tag is mandatory if the parent node has an owner
+ if "priority" not in props:
+ raise ValueError(
+ f"<priority> tag should be set for the node <{name}> path '{' '.join(my_tmpl_dir[1:])}'"
+ )
+
# Type should not be set for non-tag, non-leaf nodes
# For non-valueless leaf nodes, set the type to txt: to make them have some type,
# actual value validation is handled by constraints translated to syntax:expression:
@@ -335,4 +341,8 @@ nodes = root.iterfind("*")
for n in nodes:
if n.tag == "syntaxVersion":
continue
- process_node(n, [output_dir])
+ try:
+ process_node(n, [output_dir])
+ except ValueError as e:
+ print(e)
+ sys.exit(1)