summaryrefslogtreecommitdiff
path: root/op-mode-definitions
diff options
context:
space:
mode:
authorzsdc <taras@vyos.io>2023-01-19 20:18:42 +0200
committerJohn Estabrook <jestabro@vyos.io>2023-12-16 20:37:10 -0600
commitc1d02ab5a2594d945e3f7aed18a1c18f296d65e2 (patch)
treea9551ce1e9aa0eb8db99f2ae60567134bc2e6974 /op-mode-definitions
parentd5375ce02376a91c07ec68f8d410a08dcdc57ef9 (diff)
downloadvyos-1x-c1d02ab5a2594d945e3f7aed18a1c18f296d65e2.tar.gz
vyos-1x-c1d02ab5a2594d945e3f7aed18a1c18f296d65e2.zip
image: T4516: Added system image tools
This commit adds the whole set of system image tools written from the scratch in Python that allows performing all the operations on images: * check information * perform installation and deletion * versions management Also, it contains a new service that will update the GRUB menu and keep tracking its version in the future. WARNING: The commit contains non-reversible changes. Because of boot menu changes, it will not be possible to manage images from older VyOS versions after an update. (cherry picked from commit 8f94262e8fa2477700c50303ea6e2c6ddad72adb)
Diffstat (limited to 'op-mode-definitions')
-rw-r--r--op-mode-definitions/add-system-image.xml.in62
-rw-r--r--op-mode-definitions/system-image.xml.in189
2 files changed, 189 insertions, 62 deletions
diff --git a/op-mode-definitions/add-system-image.xml.in b/op-mode-definitions/add-system-image.xml.in
deleted file mode 100644
index 67d8aa3b4..000000000
--- a/op-mode-definitions/add-system-image.xml.in
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0"?>
-<interfaceDefinition>
- <node name="add">
- <children>
- <node name="system">
- <properties>
- <help>Add item to a system facility</help>
- </properties>
- <children>
- <tagNode name="image">
- <properties>
- <help>Add a new image to the system</help>
- <completionHelp>
- <list>/path/to/vyos-image.iso "http://example.com/vyos-image.iso"</list>
- </completionHelp>
- </properties>
- <command>sudo ${vyatta_sbindir}/install-image --url "${4}"</command>
- <children>
- <tagNode name="vrf">
- <properties>
- <help>Download image via specified VRF</help>
- <completionHelp>
- <path>vrf name</path>
- </completionHelp>
- </properties>
- <command>sudo ${vyatta_sbindir}/install-image --url "${4}" --vrf "${6}"</command>
- <children>
- <tagNode name="username">
- <properties>
- <help>Username for authentication</help>
- </properties>
- <children>
- <tagNode name="password">
- <properties>
- <help>Password to use with authentication</help>
- </properties>
- <command>sudo ${vyatta_sbindir}/install-image --url "${4}" --vrf "${6}" --username "${8}" --password "${10}"</command>
- </tagNode>
- </children>
- </tagNode>
- </children>
- </tagNode>
- <tagNode name="username">
- <properties>
- <help>Username for authentication</help>
- </properties>
- <children>
- <tagNode name="password">
- <properties>
- <help>Password to use with authentication</help>
- </properties>
- <command>sudo ${vyatta_sbindir}/install-image --url "${4}" --username "${6}" --password "${8}"</command>
- </tagNode>
- </children>
- </tagNode>
- </children>
- </tagNode>
- </children>
- </node>
- </children>
- </node>
-</interfaceDefinition>
diff --git a/op-mode-definitions/system-image.xml.in b/op-mode-definitions/system-image.xml.in
new file mode 100644
index 000000000..57aeb7bb4
--- /dev/null
+++ b/op-mode-definitions/system-image.xml.in
@@ -0,0 +1,189 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interfaceDefinition>
+ <node name="add">
+ <properties>
+ <help>Add an object</help>
+ </properties>
+ <children>
+ <node name="system">
+ <properties>
+ <help>Add item to a system facility</help>
+ </properties>
+ <children>
+ <tagNode name="image">
+ <properties>
+ <help>Add a new image to the system</help>
+ <completionHelp>
+ <list>/path/to/vyos-image.iso "http://example.com/vyos-image.iso"</list>
+ </completionHelp>
+ </properties>
+ <command>sudo ${vyos_op_scripts_dir}/image_installer.py --action add --image_path "${4}"</command>
+ <children>
+ <tagNode name="vrf">
+ <properties>
+ <help>Download image via specified VRF</help>
+ <completionHelp>
+ <path>vrf name</path>
+ </completionHelp>
+ </properties>
+ <command>sudo ${vyos_op_scripts_dir}/image_installer.py --action add --image_path "${4}" --vrf "${6}"</command>
+ <children>
+ <tagNode name="username">
+ <properties>
+ <help>Username for authentication</help>
+ </properties>
+ <children>
+ <tagNode name="password">
+ <properties>
+ <help>Password to use with authentication</help>
+ </properties>
+ <command>sudo ${vyos_op_scripts_dir}/image_installer.py --action add --image_path "${4}" --vrf "${6}" --username "${8}" --password "${10}"</command>
+ </tagNode>
+ </children>
+ </tagNode>
+ </children>
+ </tagNode>
+ <tagNode name="username">
+ <properties>
+ <help>Username for authentication</help>
+ </properties>
+ <children>
+ <tagNode name="password">
+ <properties>
+ <help>Password to use with authentication</help>
+ </properties>
+ <command>sudo ${vyos_op_scripts_dir}/image_installer.py --action add --image_path "${4}" --username "${6}" --password "${8}"</command>
+ </tagNode>
+ </children>
+ </tagNode>
+ </children>
+ </tagNode>
+ </children>
+ </node>
+ </children>
+ </node>
+ <node name="set">
+ <properties>
+ <help>Install a new system</help>
+ </properties>
+ <children>
+ <node name="system">
+ <properties>
+ <help>Set system operational parameters</help>
+ </properties>
+ <children>
+ <node name="image">
+ <properties>
+ <help>Set system image parameters</help>
+ </properties>
+ <children>
+ <tagNode name="default-boot">
+ <properties>
+ <help>Set default image to boot.</help>
+ <completionHelp>
+ <script>sudo ${vyos_op_scripts_dir}/image_manager.py --action list</script>
+ </completionHelp>
+ </properties>
+ <command>sudo ${vyos_op_scripts_dir}/image_manager.py --action set --image_name "${5}"</command>
+ </tagNode>
+ </children>
+ </node>
+ </children>
+ </node>
+ </children>
+ </node>
+ <node name="install">
+ <properties>
+ <help>Install a new system</help>
+ </properties>
+ <children>
+ <node name="image">
+ <properties>
+ <help>Install new system image to hard drive</help>
+ </properties>
+ <command>sudo ${vyos_op_scripts_dir}/image_installer.py --action install</command>
+ </node>
+ </children>
+ </node>
+ <node name="delete">
+ <properties>
+ <help>Delete an object</help>
+ </properties>
+ <children>
+ <node name="system">
+ <properties>
+ <help>Delete system objects</help>
+ </properties>
+ <children>
+ <tagNode name="image">
+ <properties>
+ <help>Remove an installed image from the system</help>
+ <completionHelp>
+ <script>sudo ${vyos_op_scripts_dir}/image_manager.py --action list</script>
+ </completionHelp>
+ </properties>
+ <command>sudo ${vyos_op_scripts_dir}/image_manager.py --action delete --image_name "${4}"</command>
+ </tagNode>
+ </children>
+ </node>
+ </children>
+ </node>
+ <node name="rename">
+ <properties>
+ <help>Rename an object</help>
+ </properties>
+ <children>
+ <node name="system">
+ <properties>
+ <help>Rename a system object</help>
+ </properties>
+ <children>
+ <tagNode name="image">
+ <properties>
+ <help>System image to rename</help>
+ <completionHelp>
+ <script>sudo ${vyos_op_scripts_dir}/image_manager.py --action list</script>
+ </completionHelp>
+ </properties>
+ <children>
+ <tagNode name="to">
+ <properties>
+ <help>A new name for an image</help>
+ </properties>
+ <command>sudo ${vyos_op_scripts_dir}/image_manager.py --action rename --image_name "${4}" --image_new_name "${6}"</command>
+ </tagNode>
+ </children>
+ </tagNode>
+ </children>
+ </node>
+ </children>
+ </node>
+ <node name="show">
+ <properties>
+ <help>Rename an object</help>
+ </properties>
+ <children>
+ <node name="system">
+ <properties>
+ <help>Show system information</help>
+ </properties>
+ <children>
+ <node name="image">
+ <properties>
+ <help>Show installed VyOS images</help>
+ </properties>
+ <command>sudo ${vyos_op_scripts_dir}/image_info.py show_images_summary</command>
+ <children>
+ <node name="details">
+ <properties>
+ <help>Show details about installed VyOS images</help>
+ </properties>
+ <command>sudo ${vyos_op_scripts_dir}/image_info.py show_images_details</command>
+ </node>
+ </children>
+ </node>
+ </children>
+ </node>
+ </children>
+ </node>
+</interfaceDefinition>