diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-06-29 11:29:23 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-06-29 11:38:54 +0000 |
commit | e07edad5f45907e9c7f4d6c24823b80cbe282316 (patch) | |
tree | eb4049b82fc0765fe2f5d731ef52a3a15cdcd282 /libexec/container/list | |
parent | Adding upstream version 20210411. (diff) | |
download | open-infrastructure-compute-tools-e07edad5f45907e9c7f4d6c24823b80cbe282316.tar.xz open-infrastructure-compute-tools-e07edad5f45907e9c7f4d6c24823b80cbe282316.zip |
Adding upstream version 20210628.upstream/20210628
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libexec/container/list')
-rwxr-xr-x | libexec/container/list | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/libexec/container/list b/libexec/container/list index 30446c0..3ef6e49 100755 --- a/libexec/container/list +++ b/libexec/container/list @@ -366,15 +366,24 @@ do ADDRESS="" - if ls "${MACHINES}/${CONTAINER}/etc/systemd/network"/*.network > /dev/null 2>&1 - then - ADDRESS="$(awk -FAddress= '/^Address/ { print $2 }' ${MACHINES}/${CONTAINER}/etc/systemd/network/*.network | head -n1)" - elif [ -e "${MACHINES}/${CONTAINER}/etc/network/interfaces" ] - then - ADDRESS="$(awk '/address/ { print $2 }' ${MACHINES}/${CONTAINER}/etc/network/interfaces | head -n1)" - fi + case "${STATE}" in + started) + ADDRESS="$(cnt run -n ${CONTAINER} -- hostname -I | sed -e 's|\r$||' | awk '{ print $1 }')" + ADDRESS="${ADDRESS:-none}" + ;; - ADDRESS="${ADDRESS:-n/a}" + *) + if ls "${MACHINES}/${CONTAINER}/etc/systemd/network"/*.network > /dev/null 2>&1 + then + ADDRESS="$(awk -FAddress= '/^Address/ { print $2 }' ${MACHINES}/${CONTAINER}/etc/systemd/network/*.network | head -n1)" + elif [ -e "${MACHINES}/${CONTAINER}/etc/network/interfaces" ] + then + ADDRESS="$(awk '/address/ { print $2 }' ${MACHINES}/${CONTAINER}/etc/network/interfaces | head -n1)" + fi + + ADDRESS="${ADDRESS:-n/a}" + ;; + esac if echo ${LIST} | grep -qs all then |