mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-07-31 20:04:45 +00:00
infra/image/shcontainer: Fix processing of multi item CAP_DEFAULTS
readarray expects to get an item per line to be added to the array.
Printing one item per line with printf fixes this to get the proper
formatting for "${CAP_DEFAULTS[@]}" as a valid input for readarray.
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
SCRIPTDIR="$(dirname -- "$(readlink -f "${BASH_SOURCE[0]}")")"
|
SCRIPTDIR="$(dirname -- "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
TOPDIR="$(readlink -f "${SCRIPTDIR}/../..")"
|
TOPDIR="$(readlink -f "${SCRIPTDIR}/../..")"
|
||||||
|
|
||||||
|
# shellcheck disable=SC1091
|
||||||
. "${SCRIPTDIR}/shdefaults"
|
. "${SCRIPTDIR}/shdefaults"
|
||||||
|
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
@@ -15,7 +16,8 @@ container_create() {
|
|||||||
shift 2
|
shift 2
|
||||||
declare -a extra_opts
|
declare -a extra_opts
|
||||||
readarray -t extra_opts < \
|
readarray -t extra_opts < \
|
||||||
<(sed -e "s/-/--cap-drop=/g" -e "s/+/--cap-add=/g" <<< "${CAP_DEFAULTS[@]}")
|
<(sed -e "s/-/--cap-drop=/g" -e "s/+/--cap-add=/g" \
|
||||||
|
<<< "$(printf '%s\n' "${CAP_DEFAULTS[@]}")")
|
||||||
for opt in "$@"
|
for opt in "$@"
|
||||||
do
|
do
|
||||||
[ -z "${opt}" ] && continue
|
[ -z "${opt}" ] && continue
|
||||||
|
|||||||
Reference in New Issue
Block a user