diff options
author | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2016-05-18 13:44:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2016-05-18 18:26:08 +0000 |
commit | ca6495519c4c98b192998c639818a39cdfe41e15 (patch) | |
tree | 86c2995adca35471cc6a29ced0fa556e97635753 | |
parent | Using systemd to cleanup network interfaces after the container has been stop... (diff) | |
download | compute-tools-ca6495519c4c98b192998c639818a39cdfe41e15.tar.xz compute-tools-ca6495519c4c98b192998c639818a39cdfe41e15.zip |
Adjusting output of additional IP addresses in container list command.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
-rwxr-xr-x | lib/container/list | 54 |
1 files changed, 48 insertions, 6 deletions
diff --git a/lib/container/list b/lib/container/list index 5ab5755..8b55e09 100755 --- a/lib/container/list +++ b/lib/container/list @@ -94,7 +94,7 @@ case "${FORMAT}" in NORMAL="$(tput sgr0)" cat << EOF -Container IPv4 Address Status +Container IPv4 Address(es) Status -------------------------------------------------------------------------------- EOF @@ -118,9 +118,9 @@ do if [ -e "${MACHINES}/${CONTAINER}/etc/network/interfaces" ] then - ADDRESS="$(awk '/address/ { print $2 }' ${MACHINES}/${CONTAINER}/etc/network/interfaces)" + ADDRESSES="$(awk '/address/ { print $2 }' ${MACHINES}/${CONTAINER}/etc/network/interfaces)" else - ADDRESS="n/a" + ADDRESSES="n/a" fi case "${STATE}" in @@ -142,7 +142,21 @@ do ;; full) - printf "%-72s %-29s %-7s\n" "${BLUE}${CONTAINER}${NORMAL}" "${YELLOW}${ADDRESS}${NORMAL}" "${STATUS}" + FIRST_LINE="true" + + for ADDRESS in ${ADDRESSES} + do + case "${FIRST_LINE}" in + true) + FIRST_LINE="false" + printf "%-69s %-29s %-7s\n" "${BLUE}${CONTAINER}${NORMAL}" "${YELLOW}${ADDRESS}${NORMAL}" " ${STATUS}" + ;; + + *) + printf "%-54s %-29s\n" "" "${ADDRESS}" + ;; + esac + done ;; esac ;; @@ -156,7 +170,21 @@ do ;; full) - printf "%-72s %-29s %-7s\n" "${BLUE}${CONTAINER}${NORMAL}" "${YELLOW}${ADDRESS}${NORMAL}" "${STATUS}" + FIRST_LINE="true" + + for ADDRESS in ${ADDRESSES} + do + case "${FIRST_LINE}" in + true) + FIRST_LINE="false" + printf "%-69s %-29s %-7s\n" "${BLUE}${CONTAINER}${NORMAL}" "${YELLOW}${ADDRESS}${NORMAL}" " ${STATUS}" + ;; + + *) + printf "%-54s %-29s\n" "" "${ADDRESS}" + ;; + esac + done ;; esac ;; @@ -175,7 +203,21 @@ do ;; full) - printf "%-72s %-29s %-7s\n" "${BLUE}${CONTAINER}${NORMAL}" "${YELLOW}${ADDRESS}${NORMAL}" "${STATUS}" + FIRST_LINE="true" + + for ADDRESS in ${ADDRESSES} + do + case "${FIRST_LINE}" in + true) + FIRST_LINE="false" + printf "%-69s %-29s %-7s\n" "${BLUE}${CONTAINER}${NORMAL}" "${YELLOW}${ADDRESS}${NORMAL}" " ${STATUS}" + ;; + + *) + printf "%-54s %-29s\n" "" "${ADDRESS}" + ;; + esac + done ;; esac ;; |