diff options
author | Adrian L Lange <git@p3lim.net> | 2024-03-23 02:39:20 +0100 |
---|---|---|
committer | Adrian L Lange <git@p3lim.net> | 2024-03-23 02:39:20 +0100 |
commit | b5d10d11fc8535a95df1fce2ddb0a2a08567fa77 (patch) | |
tree | 7892addab03f70974c7b59e532adb50a7497cdab /op-mode-definitions/container.xml.in | |
parent | db08b6bd2300b125541e7eaa35e98ae5a2225111 (diff) | |
download | vyos-1x-b5d10d11fc8535a95df1fce2ddb0a2a08567fa77.tar.gz vyos-1x-b5d10d11fc8535a95df1fce2ddb0a2a08567fa77.zip |
op-mode: T6161: Show container details in JSON format
I made some assumptions about node types, and I expanded the initial
request to also work for networks and containers.
I found that the "raw" versions of these commands already existed in
the python scripts, so I just used the existing flags.
Diffstat (limited to 'op-mode-definitions/container.xml.in')
-rw-r--r-- | op-mode-definitions/container.xml.in | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/op-mode-definitions/container.xml.in b/op-mode-definitions/container.xml.in index 4aa13e913..bb6f97b02 100644 --- a/op-mode-definitions/container.xml.in +++ b/op-mode-definitions/container.xml.in @@ -103,12 +103,28 @@ </properties> <command>sudo ${vyos_op_scripts_dir}/container.py show_container</command> <children> - <leafNode name="image"> + <node name="json"> + <properties> + <help>Show containers in JSON format</help> + </properties> + <!-- no admin check --> + <command>sudo ${vyos_op_scripts_dir}/container.py show_container --raw</command> + </node> + <node name="image"> <properties> <help>Show container image</help> </properties> <command>sudo ${vyos_op_scripts_dir}/container.py show_image</command> - </leafNode> + <children> + <node name="json"> + <properties> + <help>Show container image in JSON format</help> + </properties> + <!-- no admin check --> + <command>sudo ${vyos_op_scripts_dir}/container.py show_image --raw</command> + </node> + </children> + </node> <tagNode name="log"> <properties> <help>Show logs from a given container</help> @@ -116,14 +132,25 @@ <path>container name</path> </completionHelp> </properties> + <!-- no admin check --> <command>sudo podman logs --names "$4"</command> </tagNode> - <leafNode name="network"> + <node name="network"> <properties> <help>Show available container networks</help> </properties> + <!-- no admin check --> <command>sudo ${vyos_op_scripts_dir}/container.py show_network</command> - </leafNode> + <children> + <node name="json"> + <properties> + <help>Show available container networks in JSON format</help> + </properties> + <!-- no admin check --> + <command>sudo ${vyos_op_scripts_dir}/container.py show_network --raw</command> + </node> + </children> + </node> </children> </node> <node name="log"> |