mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-03 02:26:37 +00:00
tests: handle docker set runtime for systemd / sysconfig
Detect when dockerd config is sourced from a sysconfig file instead of being hardcoded in the systemd unit file, and improve re matching for the two cases. Fixes: #180 Signed-off-by: Marco Vedovati <mvedovati@suse.com>
This commit is contained in:
parent
caf485d3da
commit
3b3f044463
@ -190,16 +190,15 @@ set_runtime()
|
|||||||
# Travis doesn't support VT-x
|
# Travis doesn't support VT-x
|
||||||
[ -n "${TRAVIS:-}" ] && return
|
[ -n "${TRAVIS:-}" ] && return
|
||||||
|
|
||||||
source /etc/os-release
|
if [ -f "$sysconfig_docker_config_file" ]; then
|
||||||
|
|
||||||
if [[ "${ID_LIKE:-}" =~ suse ]]; then
|
|
||||||
docker_config_file="$sysconfig_docker_config_file"
|
docker_config_file="$sysconfig_docker_config_file"
|
||||||
|
sed_script="s|^( *DOCKER_OPTS=.+--default-runtime[= ] *)[^ \"]+(.*\"$)|\1${name}\2|g"
|
||||||
else
|
else
|
||||||
docker_config_file="$systemd_docker_config_file"
|
docker_config_file="$systemd_docker_config_file"
|
||||||
|
sed_script="s/--default-runtime[= ][^ ]*/--default-runtime=${name}/g"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo -E sed -i "s/--default-runtime=[^ ][^ ]*/--default-runtime=${name}/g" \
|
sudo -E sed -i -E "$sed_script" "$docker_config_file"
|
||||||
"${docker_config_file}"
|
|
||||||
sudo -E systemctl daemon-reload
|
sudo -E systemctl daemon-reload
|
||||||
sudo -E systemctl restart docker
|
sudo -E systemctl restart docker
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user