diff options
author | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2016-12-11 11:40:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2016-12-11 12:13:00 +0000 |
commit | 0630f78d6b737b38828e3a4245abc69076caffcf (patch) | |
tree | 3f0d2401178d2803f2eef26d1a9ae4f959da51c1 | |
parent | Adding nwdiag export format to container list command. (diff) | |
download | compute-tools-0630f78d6b737b38828e3a4245abc69076caffcf.tar.xz compute-tools-0630f78d6b737b38828e3a4245abc69076caffcf.zip |
Adding YAML export format to container list command.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to '')
-rwxr-xr-x | lib/container/list | 24 | ||||
-rw-r--r-- | share/bash-completion/container | 2 | ||||
-rw-r--r-- | share/man/container-list.1.txt | 5 |
3 files changed, 29 insertions, 2 deletions
diff --git a/lib/container/list b/lib/container/list index 45430a4..2be55b5 100755 --- a/lib/container/list +++ b/lib/container/list @@ -162,6 +162,15 @@ EOF shell) echo "${CONTAINER}" ;; + + yaml) + +cat << EOF + - name: ${CONTAINER} + ipv4_address: ${ADDRESS} +EOF + + ;; esac } @@ -257,6 +266,21 @@ cat << EOF EOF ;; + + yaml) + +cat << EOF +--- +container_tools: + version: ${VERSION} + +host: + name: ${HOST} + +container: +EOF + + ;; esac CONTAINERS="$(cd "${MACHINES}" 2>/dev/null && find -maxdepth 1 -type d -and -not -name '.container-tools' -and -not -name 'container-tools' -and -not -name 'lost+found' -and -not -name '.snap' -and -not -name '.snapshot' -printf '%P\n' | sort)" diff --git a/share/bash-completion/container b/share/bash-completion/container index abdd89a..523bc08 100644 --- a/share/bash-completion/container +++ b/share/bash-completion/container @@ -139,7 +139,7 @@ _container() ;; -f|--format) - opts="cli csv json nwdiag shell" + opts="cli csv json nwdiag shell yaml" COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 ;; diff --git a/share/man/container-list.1.txt b/share/man/container-list.1.txt index f19d2ef..962d782 100644 --- a/share/man/container-list.1.txt +++ b/share/man/container-list.1.txt @@ -50,7 +50,7 @@ The following container options are available, defaults to *--started --stopped* Specify custom CSV separator, defaults to ','. *-f, --format='FORMAT'*:: - Use format to list container. Currently available formats are 'cli' (default), 'csv', 'json', 'nwdiag', or 'shell'. + Use format to list container. Currently available formats are 'cli' (default), 'csv', 'json', 'nwdiag', 'shell', or 'yaml'. *-h, --host='HOSTNAME'*:: List only container that are enabled for automatic start on the specified hostname. Defaults to list containers of the local system only. Using 'all' shows all container regardless of any automatic start configuration. @@ -93,6 +93,9 @@ EXAMPLES *Create a shell export of all started and stopped containers:*:: sudo container list -f shell +*Create a YAML export of all started and stopped containers:*:: + sudo container list -f yaml + SEE ALSO -------- |