diff options
-rwxr-xr-x | debian/rules | 20 | ||||
-rw-r--r-- | interface-definitions/bcast-relay.xml | 2 | ||||
-rw-r--r-- | interface-definitions/cron.xml | 2 | ||||
-rw-r--r-- | interface-definitions/dns-forwarding.xml | 2 | ||||
-rw-r--r-- | interface-definitions/host-name.xml | 2 | ||||
-rw-r--r-- | interface-definitions/mdns-repeater.xml | 2 | ||||
-rw-r--r-- | interface-definitions/ntp.xml | 7 | ||||
-rw-r--r-- | interface-definitions/ssh.xml | 2 | ||||
-rw-r--r-- | op-mode-definitions/bandwidth-monitor.xml | 2 | ||||
-rw-r--r-- | op-mode-definitions/traffic-dump.xml | 2 | ||||
-rwxr-xr-x | scripts/build-command-templates | 5 | ||||
-rwxr-xr-x | src/completion/list_dumpable_interfaces.py (renamed from src/op_mode/vyos_list_dumpable_interfaces.py) | 0 | ||||
-rwxr-xr-x | src/completion/list_interfaces.py (renamed from src/op_mode/vyos_list_interfaces.py) | 0 | ||||
-rwxr-xr-x | src/conf_mode/bcast_relay.py (renamed from src/conf_mode/vyos_config_bcast_relay.py) | 0 | ||||
-rwxr-xr-x | src/conf_mode/dns_forwarding.py (renamed from src/conf_mode/vyos_config_dns_forwarding.py) | 0 | ||||
-rwxr-xr-x | src/conf_mode/host_name.py (renamed from src/conf_mode/vyos_config_host_name.py) | 0 | ||||
-rw-r--r-- | src/conf_mode/lldp.py (renamed from src/conf_mode/vyos_config_lldp.py) | 0 | ||||
-rwxr-xr-x | src/conf_mode/mdns_repeater.py (renamed from src/conf_mode/vyos_config_mdns_repeater.py) | 0 | ||||
-rwxr-xr-x | src/conf_mode/ntp.py (renamed from src/conf_mode/vyos_config_ntp.py) | 0 | ||||
-rwxr-xr-x | src/conf_mode/ssh.py (renamed from src/conf_mode/vyos_config_ssh.py) | 0 | ||||
-rwxr-xr-x | src/conf_mode/task_scheduler.py (renamed from src/conf_mode/vyos_update_crontab.py) | 0 | ||||
-rwxr-xr-x | src/op_mode/dns_forwarding_restart.sh (renamed from src/op_mode/vyos_restart_dns_forwarding.sh) | 0 | ||||
-rwxr-xr-x | src/op_mode/dns_forwarding_statistics.py (renamed from src/op_mode/vyos_dns_forwarding_statistics.py) | 0 | ||||
-rwxr-xr-x | src/op_mode/version.py (renamed from src/op_mode/vyos_show_version.py) | 0 | ||||
-rw-r--r-- | src/tests/test_vyos_update_crontab.py | 20 |
25 files changed, 38 insertions, 30 deletions
diff --git a/debian/rules b/debian/rules index 3781a6f71..31deefeff 100755 --- a/debian/rules +++ b/debian/rules @@ -1,9 +1,9 @@ #!/usr/bin/make -f DIR := debian/vyos-1x -VYOS_SBIN_DIR := opt/vyatta/sbin/ -VYOS_BIN_DIR := opt/vyatta/bin/ -VYOS_LIBEXEC_DIR := opt/vyatta/libexec +VYOS_SBIN_DIR := usr/sbin/ +VYOS_BIN_DIR := usr/bin/ +VYOS_LIBEXEC_DIR := usr/libexec/vyos VYOS_CFG_TMPL_DIR := /opt/vyatta/share/vyatta-cfg/templates VYOS_OP_TMPL_DIR := /opt/vyatta/share/vyatta-op/templates @@ -20,13 +20,23 @@ override_dh_auto_install: # Install scripts mkdir -p $(DIR)/$(VYOS_SBIN_DIR) mkdir -p $(DIR)/$(VYOS_BIN_DIR) - cp -r src/conf_mode/* $(DIR)/$(VYOS_SBIN_DIR) - cp -r src/op_mode/* $(DIR)/$(VYOS_BIN_DIR) + + # Install conf mode scripts + mkdir -p $(DIR)/$(VYOS_LIBEXEC_DIR)/conf_mode + cp -r src/conf_mode/* $(DIR)/$(VYOS_LIBEXEC_DIR)/conf_mode + + # Install op mode scripts + mkdir -p $(DIR)/$(VYOS_LIBEXEC_DIR)/op_mode + cp -r src/op_mode/* $(DIR)/$(VYOS_LIBEXEC_DIR)/op_mode # Install validators mkdir -p $(DIR)/$(VYOS_LIBEXEC_DIR)/validators cp -r src/validators/* $(DIR)/$(VYOS_LIBEXEC_DIR)/validators + # Install completion helpers + mkdir -p $(DIR)/$(VYOS_LIBEXEC_DIR)/completion + cp -r src/completion/* $(DIR)/$(VYOS_LIBEXEC_DIR)/completion + # Install helper scripts cp -r src/helpers/* $(DIR)/$(VYOS_LIBEXEC_DIR)/ diff --git a/interface-definitions/bcast-relay.xml b/interface-definitions/bcast-relay.xml index bacf771ac..98c54051e 100644 --- a/interface-definitions/bcast-relay.xml +++ b/interface-definitions/bcast-relay.xml @@ -10,7 +10,7 @@ <help>UDP Broadcast Relay parameters</help> </properties> <children> - <tagNode name="id" owner="${vyos_sbindir}/vyos-config_bcast_relay.py"> + <tagNode name="id" owner="${vyos_conf_scripts_dir}/bcast_relay.py"> <properties> <help>Unique ID for each UDP port to forward</help> <valueHelp> diff --git a/interface-definitions/cron.xml b/interface-definitions/cron.xml index fa2a589fa..2d4921bf0 100644 --- a/interface-definitions/cron.xml +++ b/interface-definitions/cron.xml @@ -10,7 +10,7 @@ <help>Task scheduler settings</help> </properties> <children> - <tagNode name="task" owner="${vyos_sbindir}/vyos_update_crontab.py"> + <tagNode name="task" owner="${vyos_conf_scripts_dir}/task_scheduler.py"> <properties> <help>Scheduled task</help> <valueHelp> diff --git a/interface-definitions/dns-forwarding.xml b/interface-definitions/dns-forwarding.xml index 73180b9a4..ffc007a30 100644 --- a/interface-definitions/dns-forwarding.xml +++ b/interface-definitions/dns-forwarding.xml @@ -7,7 +7,7 @@ <children> <node name="dns"> <children> - <node name="forwarding" owner="${vyos_sbindir}/vyos_config_dns_forwarding.py"> + <node name="forwarding" owner="${vyos_conf_scripts_dir}/dns_forwarding.py"> <properties> <help>DNS forwarding</help> <priority>918</priority> diff --git a/interface-definitions/host-name.xml b/interface-definitions/host-name.xml index 7ccce89b4..6c7c373cc 100644 --- a/interface-definitions/host-name.xml +++ b/interface-definitions/host-name.xml @@ -5,7 +5,7 @@ <interfaceDefinition> <node name="system"> <children> - <leafNode name="host-name" owner="${vyos_sbindir}/vyos_config_host_name.py"> + <leafNode name="host-name" owner="${vyos_conf_scripts_dir}/host_name.py"> <properties> <help>System host name (default: vyos)</help> <constraint> diff --git a/interface-definitions/mdns-repeater.xml b/interface-definitions/mdns-repeater.xml index 82aa3235b..066b665cf 100644 --- a/interface-definitions/mdns-repeater.xml +++ b/interface-definitions/mdns-repeater.xml @@ -10,7 +10,7 @@ <help>Multicast DNS (mDNS) parameters</help> </properties> <children> - <node name="repeater" owner="${vyos_sbindir}/vyos_config_mdns_repeater.py"> + <node name="repeater" owner="${vyos_conf_scripts_dir}/mdns_repeater.py"> <properties> <help>mDNS repeater configuration</help> <priority>990</priority> diff --git a/interface-definitions/ntp.xml b/interface-definitions/ntp.xml index 311d61dbe..4688454c3 100644 --- a/interface-definitions/ntp.xml +++ b/interface-definitions/ntp.xml @@ -5,7 +5,7 @@ <interfaceDefinition> <node name="system"> <children> - <node name="ntp" owner="${vyos_sbindir}/vyos_config_ntp.py"> + <node name="ntp" owner="${vyos_conf_scripts_dir}/ntp.py"> <properties> <help>Network Time Protocol (NTP) configuration</help> <priority>400</priority> @@ -45,9 +45,6 @@ <node name="allow-clients"> <properties> <help>Network Time Protocol (NTP) server options</help> - <constraint> - <validator name="ip-prefix"/> - </constraint> </properties> <children> <leafNode name="address"> @@ -63,7 +60,7 @@ </valueHelp> <multi/> <constraint> - <validator name="ip-address"/> + <validator name="ip-prefix"/> </constraint> </properties> </leafNode> diff --git a/interface-definitions/ssh.xml b/interface-definitions/ssh.xml index 146aec6b6..22741c41a 100644 --- a/interface-definitions/ssh.xml +++ b/interface-definitions/ssh.xml @@ -5,7 +5,7 @@ <interfaceDefinition> <node name="service"> <children> - <node name="ssh" owner="${vyos_sbindir}/vyos_config_ssh.py"> + <node name="ssh" owner="${vyos_conf_scripts_dir}/ssh.py"> <properties> <help>Secure SHell (SSH) protocol</help> <priority>500</priority> diff --git a/op-mode-definitions/bandwidth-monitor.xml b/op-mode-definitions/bandwidth-monitor.xml index 38d099613..410ab4938 100644 --- a/op-mode-definitions/bandwidth-monitor.xml +++ b/op-mode-definitions/bandwidth-monitor.xml @@ -12,7 +12,7 @@ <properties> <help>Monitor bandwidth usage on specified interface</help> <completionHelp> - <script>${vyos_bindir}/vyos_list_interfaces.py</script> + <script>${vyos_completion_dir}/list_interfaces.py</script> </completionHelp> </properties> </tagNode> diff --git a/op-mode-definitions/traffic-dump.xml b/op-mode-definitions/traffic-dump.xml index d8599bf93..a6810644e 100644 --- a/op-mode-definitions/traffic-dump.xml +++ b/op-mode-definitions/traffic-dump.xml @@ -12,7 +12,7 @@ <properties> <help>Monitor traffic dump from an interface</help> <completionHelp> - <script>${vyos_bindir}/vyos_list_dumpable_interfaces.py</script> + <script>${vyos_completion_dir}/list_dumpable_interfaces.py</script> </completionHelp> </properties> <children> diff --git a/scripts/build-command-templates b/scripts/build-command-templates index 9f51c00cd..a99f317d7 100755 --- a/scripts/build-command-templates +++ b/scripts/build-command-templates @@ -30,7 +30,8 @@ from lxml import etree as ET # Defaults -validator_dir = "/opt/vyatta/libexec/validators" +#validator_dir = "/usr/libexec/vyos/validators" +validator_dir = "${vyos_validators_dir}" default_constraint_err_msg = "Invalid value" @@ -147,7 +148,7 @@ def get_properties(p): regex_args = " ".join(map(lambda s: "--regex \\\'{0}\\\'".format(s), regexes)) validator_args = " ".join(map(lambda s: "--exec \\\"{0}\\\"".format(s), validators)) - validator_script = '${vyos_libexecdir}/validate-value.py' + validator_script = '${vyos_libexec_dir}/validate-value.py' validator_string = "exec \"{0} {1} {2} --value \\\'$VAR(@)\\\'\"; \"{3}\"".format(validator_script, regex_args, validator_args, error_msg) props["constraint"] = validator_string diff --git a/src/op_mode/vyos_list_dumpable_interfaces.py b/src/completion/list_dumpable_interfaces.py index 53ee89633..53ee89633 100755 --- a/src/op_mode/vyos_list_dumpable_interfaces.py +++ b/src/completion/list_dumpable_interfaces.py diff --git a/src/op_mode/vyos_list_interfaces.py b/src/completion/list_interfaces.py index 59c9dffad..59c9dffad 100755 --- a/src/op_mode/vyos_list_interfaces.py +++ b/src/completion/list_interfaces.py diff --git a/src/conf_mode/vyos_config_bcast_relay.py b/src/conf_mode/bcast_relay.py index 785690d9c..785690d9c 100755 --- a/src/conf_mode/vyos_config_bcast_relay.py +++ b/src/conf_mode/bcast_relay.py diff --git a/src/conf_mode/vyos_config_dns_forwarding.py b/src/conf_mode/dns_forwarding.py index be48cde60..be48cde60 100755 --- a/src/conf_mode/vyos_config_dns_forwarding.py +++ b/src/conf_mode/dns_forwarding.py diff --git a/src/conf_mode/vyos_config_host_name.py b/src/conf_mode/host_name.py index 2a245b211..2a245b211 100755 --- a/src/conf_mode/vyos_config_host_name.py +++ b/src/conf_mode/host_name.py diff --git a/src/conf_mode/vyos_config_lldp.py b/src/conf_mode/lldp.py index ba7e9cb13..ba7e9cb13 100644 --- a/src/conf_mode/vyos_config_lldp.py +++ b/src/conf_mode/lldp.py diff --git a/src/conf_mode/vyos_config_mdns_repeater.py b/src/conf_mode/mdns_repeater.py index e648fd64f..e648fd64f 100755 --- a/src/conf_mode/vyos_config_mdns_repeater.py +++ b/src/conf_mode/mdns_repeater.py diff --git a/src/conf_mode/vyos_config_ntp.py b/src/conf_mode/ntp.py index 8be12e44e..8be12e44e 100755 --- a/src/conf_mode/vyos_config_ntp.py +++ b/src/conf_mode/ntp.py diff --git a/src/conf_mode/vyos_config_ssh.py b/src/conf_mode/ssh.py index a4857bba9..a4857bba9 100755 --- a/src/conf_mode/vyos_config_ssh.py +++ b/src/conf_mode/ssh.py diff --git a/src/conf_mode/vyos_update_crontab.py b/src/conf_mode/task_scheduler.py index c19b88007..c19b88007 100755 --- a/src/conf_mode/vyos_update_crontab.py +++ b/src/conf_mode/task_scheduler.py diff --git a/src/op_mode/vyos_restart_dns_forwarding.sh b/src/op_mode/dns_forwarding_restart.sh index 12106fcc1..12106fcc1 100755 --- a/src/op_mode/vyos_restart_dns_forwarding.sh +++ b/src/op_mode/dns_forwarding_restart.sh diff --git a/src/op_mode/vyos_dns_forwarding_statistics.py b/src/op_mode/dns_forwarding_statistics.py index 3d1e30aee..3d1e30aee 100755 --- a/src/op_mode/vyos_dns_forwarding_statistics.py +++ b/src/op_mode/dns_forwarding_statistics.py diff --git a/src/op_mode/vyos_show_version.py b/src/op_mode/version.py index ce3b3b54f..ce3b3b54f 100755 --- a/src/op_mode/vyos_show_version.py +++ b/src/op_mode/version.py diff --git a/src/tests/test_vyos_update_crontab.py b/src/tests/test_vyos_update_crontab.py index 180871300..7acbbddc5 100644 --- a/src/tests/test_vyos_update_crontab.py +++ b/src/tests/test_vyos_update_crontab.py @@ -22,11 +22,11 @@ import unittest from vyos import ConfigError try: - from src.conf_mode import vyos_update_crontab + from src.conf_mode import task_scheduler except ModuleNotFoundError: # for unittest.main() import sys sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) - from src.conf_mode import vyos_update_crontab + from src.conf_mode import task_scheduler class TestUpdateCrontab(unittest.TestCase): @@ -74,9 +74,9 @@ class TestUpdateCrontab(unittest.TestCase): with self.subTest(msg=t['name'], tasks=t['tasks'], expected=t['expected']): if t['expected'] is not None: with self.assertRaises(t['expected']): - vyos_update_crontab.verify(t['tasks']) + task_scheduler.verify(t['tasks']) else: - vyos_update_crontab.verify(t['tasks']) + task_scheduler.verify(t['tasks']) def test_generate(self): tests = [ @@ -114,16 +114,16 @@ class TestUpdateCrontab(unittest.TestCase): ] for t in tests: with self.subTest(msg=t['name'], tasks=t['tasks'], expected=t['expected']): - vyos_update_crontab.crontab_file = tempfile.mkstemp()[1] - vyos_update_crontab.generate(t['tasks']) + task_scheduler.crontab_file = tempfile.mkstemp()[1] + task_scheduler.generate(t['tasks']) if len(t['expected']) > 0: - self.assertTrue(os.path.isfile(vyos_update_crontab.crontab_file)) - with open(vyos_update_crontab.crontab_file) as f: + self.assertTrue(os.path.isfile(task_scheduler.crontab_file)) + with open(task_scheduler.crontab_file) as f: actual = f.read() self.assertEqual(t['expected'], actual.splitlines()) - os.remove(vyos_update_crontab.crontab_file) + os.remove(task_scheduler.crontab_file) else: - self.assertFalse(os.path.isfile(vyos_update_crontab.crontab_file)) + self.assertFalse(os.path.isfile(task_scheduler.crontab_file)) if __name__ == "__main__": |