summaryrefslogtreecommitdiffstats
path: root/libexec/container/list
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-07-26 03:57:11 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-07-26 03:57:11 +0000
commitf277567cc45fc61cfca8ba30d89813855440eb93 (patch)
tree2268932e0e1cb4bdd65cc17b1c3b0070d6db10d7 /libexec/container/list
parentAdding upstream version 20210725. (diff)
downloadopen-infrastructure-compute-tools-f277567cc45fc61cfca8ba30d89813855440eb93.tar.xz
open-infrastructure-compute-tools-f277567cc45fc61cfca8ba30d89813855440eb93.zip
Adding upstream version 20210726.upstream/20210726
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libexec/container/list')
-rwxr-xr-xlibexec/container/list11
1 files changed, 10 insertions, 1 deletions
diff --git a/libexec/container/list b/libexec/container/list
index 3ef6e49..6567afb 100755
--- a/libexec/container/list
+++ b/libexec/container/list
@@ -368,7 +368,16 @@ do
case "${STATE}" in
started)
- ADDRESS="$(cnt run -n ${CONTAINER} -- hostname -I | sed -e 's|\r$||' | awk '{ print $1 }')"
+ case "${FORMAT}" in
+ shell|sh)
+ ;;
+
+ *)
+ LEADER="$(machinectl status ${CONTAINER} | awk '/Leader: / { print $2 }')"
+ ADDRESS="$(nsenter --all --target "${LEADER}" /bin/hostname -I | sed -e 's|\r$||' | awk '{ print $1 }')"
+ ;;
+ esac
+
ADDRESS="${ADDRESS:-none}"
;;