diff options
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | Makefile | 18 | ||||
-rwxr-xr-x | debian/rules | 13 | ||||
-rw-r--r-- | python/vyos/version.py (renamed from python/vyos/util.py) | 0 | ||||
-rw-r--r-- | schema/op-mode-definition.rnc | 5 | ||||
-rw-r--r-- | schema/op-mode-definition.rng | 10 | ||||
-rwxr-xr-x | scripts/build-command-op-templates | 2 |
7 files changed, 38 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore index 9082493d3..ff15b4fbb 100644 --- a/.gitignore +++ b/.gitignore @@ -104,7 +104,8 @@ ENV/ .mypy_cache/ # Autogenerated files -templates/* +templates-cfg/* +templates-op/* tests/templates/* # Debian packaging @@ -1,4 +1,5 @@ -TMPL_DIR := templates +TMPL_DIR := templates-cfg +OP_TMPL_DIR := templates-op .PHONY: interface_definitions .ONESHELL: @@ -13,9 +14,22 @@ interface_definitions: rm -f $(TMPL_DIR)/service/dns/node.def rm -f $(TMPL_DIR)/protocols/node.def +.PHONY: op_mode_definitions +.ONESHELL: +op_mode_definitions: + mkdir -p $(OP_TMPL_DIR) + + find $(CURDIR)/op-mode-definitions/ -type f | xargs -I {} $(CURDIR)/scripts/build-command-op-templates {} $(CURDIR)/schema/op-mode-definition.rng $(OP_TMPL_DIR) + + # XXX: delete top level op mode node.def's that now live in other packages + rm -f $(OP_TMPL_DIR)/show/node.def + rm -f $(OP_TMPL_DIR)/reset/node.def + rm -f $(OP_TMPL_DIR)/restart/node.def + .PHONY: all -all: interface_definitions +all: interface_definitions op_mode_definitions .PHONY: clean clean: rm -rf $(TMPL_DIR)/* + rm -rf $(OP_TMPL_DIR)/* diff --git a/debian/rules b/debian/rules index 5c3aab7f6..d10f6f450 100755 --- a/debian/rules +++ b/debian/rules @@ -2,26 +2,33 @@ DIR := debian/vyos-1x VYOS_SBIN_DIR := opt/vyatta/sbin/ +VYOS_BIN_DIR := opt/vyatta/bin/ VYOS_LIBEXEC_DIR := opt/vyatta/libexec VYOS_CFG_TMPL_DIR := /opt/vyatta/share/vyatta-cfg/templates +VYOS_OP_TMPL_DIR := /opt/vyatta/share/vyatta-op/templates %: dh $@ --with python3, --with quilt override_dh_auto_build: - make + make all override_dh_auto_install: dh_install -pvyos-1x cd python; python3 setup.py install --install-layout=deb --root ../$(DIR); cd .. - # Install configuration scripts + # 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 validators mkdir -p $(DIR)/$(VYOS_LIBEXEC_DIR)/validators cp -r src/validators/* $(DIR)/$(VYOS_LIBEXEC_DIR)/validators mkdir -p $(DIR)/$(VYOS_CFG_TMPL_DIR) - cp -r templates/* $(DIR)/$(VYOS_CFG_TMPL_DIR) + cp -r templates-cfg/* $(DIR)/$(VYOS_CFG_TMPL_DIR) + + mkdir -p $(DIR)/$(VYOS_OP_TMPL_DIR) + cp -r templates-op/* $(DIR)/$(VYOS_OP_TMPL_DIR) diff --git a/python/vyos/util.py b/python/vyos/version.py index b3eff3965..b3eff3965 100644 --- a/python/vyos/util.py +++ b/python/vyos/version.py diff --git a/schema/op-mode-definition.rnc b/schema/op-mode-definition.rnc index 01276123c..9c84de0e4 100644 --- a/schema/op-mode-definition.rnc +++ b/schema/op-mode-definition.rnc @@ -52,8 +52,7 @@ tagNode = element tagNode leafNode = element leafNode { nodeNameAttr, - command, - properties + (command & properties) } # Normal and tag nodes may have children @@ -105,4 +104,4 @@ completionHelp = element completionHelp (element list { text })* & (element path { text })* & (element script { text })* -}
\ No newline at end of file +} diff --git a/schema/op-mode-definition.rng b/schema/op-mode-definition.rng index 98a231e53..e9e7887cf 100644 --- a/schema/op-mode-definition.rng +++ b/schema/op-mode-definition.rng @@ -67,7 +67,9 @@ <optional> <ref name="properties"/> </optional> - <ref name="children"/> + <optional> + <ref name="children"/> + </optional> <optional> <ref name="command"/> </optional> @@ -81,8 +83,10 @@ <define name="leafNode"> <element name="leafNode"> <ref name="nodeNameAttr"/> - <ref name="command"/> - <ref name="properties"/> + <interleave> + <ref name="command"/> + <ref name="properties"/> + </interleave> </element> </define> <!-- Normal and tag nodes may have children --> diff --git a/scripts/build-command-op-templates b/scripts/build-command-op-templates index 6b6688fba..72879fe74 100755 --- a/scripts/build-command-op-templates +++ b/scripts/build-command-op-templates @@ -145,7 +145,7 @@ def make_node_def(props, command): if command is not None: - node_def += "run: sudo sh -c {0}\n".format(command.text) + node_def += "run: sudo sh -c \"{0}\"\n".format(command.text) if debug: |