From b1ff7baaf3c52c8c364955632fcece2da7033b10 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Thu, 2 Sep 2021 14:05:33 +0200 Subject: op-mode: T1376: speed up tab-completion for DHCP pool listing Commit 9f20bee81c ("T1376: improve show_dhcp and show_dhcpv6") added the tab completion helper to list the availbale IP pools to query. This was done by calling a python script which then called cli-shell-api which resulted in a penalty by the Python interpreter startup. This can be solved by directly using the cli-shell-api wrapper available as in op-mode - as also seen for DHCPv6. --- op-mode-definitions/dhcp.xml.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'op-mode-definitions/dhcp.xml.in') diff --git a/op-mode-definitions/dhcp.xml.in b/op-mode-definitions/dhcp.xml.in index 1dacbd5ba..6f0c25110 100644 --- a/op-mode-definitions/dhcp.xml.in +++ b/op-mode-definitions/dhcp.xml.in @@ -22,7 +22,7 @@ Show DHCP server leases for a specific pool - + service dhcp-server shared-network-name sudo ${vyos_op_scripts_dir}/show_dhcp.py --leases --pool $6 @@ -57,7 +57,7 @@ Show DHCP server statistics for a specific pool - + service dhcp-server shared-network-name sudo ${vyos_op_scripts_dir}/show_dhcp.py --statistics --pool $6 -- cgit v1.2.3 From 41807725cad3266bf426a9de411bb693b914395e Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 19 Sep 2021 09:17:00 +0200 Subject: dhcp: op-mode: xml: fix duplicate help string --- op-mode-definitions/dhcp.xml.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'op-mode-definitions/dhcp.xml.in') diff --git a/op-mode-definitions/dhcp.xml.in b/op-mode-definitions/dhcp.xml.in index 6f0c25110..9b21cb9af 100644 --- a/op-mode-definitions/dhcp.xml.in +++ b/op-mode-definitions/dhcp.xml.in @@ -128,13 +128,13 @@ - Restart the DHCP server process + Restart DHCP server process sudo systemctl restart isc-dhcp-server.service - Restart the DHCP server process + Restart DHCP relay agent sudo ${vyos_op_scripts_dir}/restart_dhcp_relay.py --ipv4 -- cgit v1.2.3 From 83f9d4b8bac6b5d401dfea19d4f9d61b7e638a47 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 19 Sep 2021 09:17:36 +0200 Subject: dhcp: op-mode: xml: error out if DHCP service not configured --- op-mode-definitions/dhcp.xml.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'op-mode-definitions/dhcp.xml.in') diff --git a/op-mode-definitions/dhcp.xml.in b/op-mode-definitions/dhcp.xml.in index 9b21cb9af..4e7568ab6 100644 --- a/op-mode-definitions/dhcp.xml.in +++ b/op-mode-definitions/dhcp.xml.in @@ -130,7 +130,7 @@ Restart DHCP server process - sudo systemctl restart isc-dhcp-server.service + if cli-shell-api existsActive service dhcp-server; then sudo systemctl restart isc-dhcp-server.service; else echo "DHCP server not configured"; fi -- cgit v1.2.3 From 5d4c75d7fdecc56a8864a3ef76ead3f6121a0cff Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 19 Sep 2021 09:21:00 +0200 Subject: dhcpv6: op-mode: xml: fix duplicate help strings --- op-mode-definitions/dhcp.xml.in | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'op-mode-definitions/dhcp.xml.in') diff --git a/op-mode-definitions/dhcp.xml.in b/op-mode-definitions/dhcp.xml.in index 4e7568ab6..7f4bdb990 100644 --- a/op-mode-definitions/dhcp.xml.in +++ b/op-mode-definitions/dhcp.xml.in @@ -123,18 +123,18 @@ - Restart DHCP server processes + Restart DHCP processes - Restart DHCP server process + Restart DHCP server if cli-shell-api existsActive service dhcp-server; then sudo systemctl restart isc-dhcp-server.service; else echo "DHCP server not configured"; fi - Restart DHCP relay agent + Restart DHCP relay-agent sudo ${vyos_op_scripts_dir}/restart_dhcp_relay.py --ipv4 @@ -142,18 +142,18 @@ - Restart DHCPv6 server processes + Restart DHCPv6 processes - Restart the DHCPv6 server process + Restart DHCPv6 server sudo systemctl restart isc-dhcp-server6.service - Restart the DHCP server process + Restart DHCPv6 relay-agent sudo ${vyos_op_scripts_dir}/restart_dhcp_relay.py --ipv6 -- cgit v1.2.3 From 224f0b8042f439b8dcc0eb32730da669e8b163af Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 19 Sep 2021 09:21:25 +0200 Subject: dhcpv6: op-mode: xml: error out if DHCPv6 service not configured Restarting DHCPv6 server should not be possible when service is not configured on the CLI. --- op-mode-definitions/dhcp.xml.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'op-mode-definitions/dhcp.xml.in') diff --git a/op-mode-definitions/dhcp.xml.in b/op-mode-definitions/dhcp.xml.in index 7f4bdb990..241cca0ce 100644 --- a/op-mode-definitions/dhcp.xml.in +++ b/op-mode-definitions/dhcp.xml.in @@ -149,7 +149,7 @@ Restart DHCPv6 server - sudo systemctl restart isc-dhcp-server6.service + if cli-shell-api existsActive service dhcpv6-server; then sudo systemctl restart isc-dhcp-server6.service; else echo "DHCPv6 server not configured"; fi -- cgit v1.2.3