summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2021-07-25 13:50:05 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2021-07-26 03:46:53 +0000
commit5c3fbecb207a39fc07d79988dd2b3f235338f2b3 (patch)
treed21399299ed36fc56a90c63aaf26eb30423d8106 /libexec
parentSpeeding up container list command by not gathering IP addresses for output f... (diff)
downloadcompute-tools-5c3fbecb207a39fc07d79988dd2b3f235338f2b3.tar.xz
compute-tools-5c3fbecb207a39fc07d79988dd2b3f235338f2b3.zip
Speeding up container list command by optimizing IP address gathering.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to '')
-rwxr-xr-xlibexec/container/list3
1 files changed, 2 insertions, 1 deletions
diff --git a/libexec/container/list b/libexec/container/list
index 17a1958..6567afb 100755
--- a/libexec/container/list
+++ b/libexec/container/list
@@ -373,7 +373,8 @@ do
;;
*)
- ADDRESS="$(cnt run -n ${CONTAINER} -- hostname -I | sed -e 's|\r$||' | awk '{ print $1 }')"
+ LEADER="$(machinectl status ${CONTAINER} | awk '/Leader: / { print $2 }')"
+ ADDRESS="$(nsenter --all --target "${LEADER}" /bin/hostname -I | sed -e 's|\r$||' | awk '{ print $1 }')"
;;
esac