diff --git a/resources/sushy-tools/Dockerfile b/resources/sushy-tools/Dockerfile index ac090386a..d23eff78d 100644 --- a/resources/sushy-tools/Dockerfile +++ b/resources/sushy-tools/Dockerfile @@ -9,5 +9,6 @@ RUN apt-get update && \ pip3 install --no-cache-dir \ sushy-tools==${SUSHY_TOOLS_VERSION} libvirt-python -CMD /usr/local/bin/sushy-emulator -i :: \ - --config /root/sushy/conf.py --debug +COPY redfish-emulator.sh /usr/local/bin/ + +CMD /usr/local/bin/redfish-emulator.sh diff --git a/resources/sushy-tools/redfish-emulator.sh b/resources/sushy-tools/redfish-emulator.sh new file mode 100755 index 000000000..a97599faf --- /dev/null +++ b/resources/sushy-tools/redfish-emulator.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set -eux -o pipefail + +CONFIG="${SUSHY_TOOLS_CONFIG:-/root/sushy/conf.py}" +ARGS= + +if [[ -f "${CONFIG}" ]]; then + ARGS="${ARGS} --config ${CONFIG}" +fi + +if [[ ! -f "${CONFIG}" ]] || ! grep -q "^SUSHY_EMULATOR_LISTEN_IP =" "${CONFIG}"; then + # Listen on all interfaces unless explicitly configured otherwise. + ARGS="${ARGS} --interface ::" +fi + +# shellcheck disable=SC2086 +exec /usr/local/bin/sushy-emulator --debug $ARGS