summaryrefslogtreecommitdiff
path: root/op-mode-definitions
diff options
context:
space:
mode:
authorAdrian L Lange <git@p3lim.net>2024-03-23 02:39:20 +0100
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2024-03-23 16:54:20 +0000
commitd1181459e4397c9289b82eb39ff09769213d5a00 (patch)
treed60fc29a1a9acae080e948a8bf9c6f898e1e7159 /op-mode-definitions
parenta72102b89566451bce40beb1ffdb5d2bf0b1dcc2 (diff)
downloadvyos-1x-d1181459e4397c9289b82eb39ff09769213d5a00.tar.gz
vyos-1x-d1181459e4397c9289b82eb39ff09769213d5a00.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. (cherry picked from commit b5d10d11fc8535a95df1fce2ddb0a2a08567fa77)
Diffstat (limited to 'op-mode-definitions')
-rw-r--r--op-mode-definitions/container.xml.in35
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">