From 3b3f044463b040a573420389adc25a26a322342b Mon Sep 17 00:00:00 2001 From: Marco Vedovati Date: Mon, 8 Oct 2018 13:03:50 +0200 Subject: [PATCH] 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 --- tests/test_images.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/test_images.sh b/tests/test_images.sh index 6d305d1e4c..35ba5534ef 100755 --- a/tests/test_images.sh +++ b/tests/test_images.sh @@ -190,16 +190,15 @@ set_runtime() # Travis doesn't support VT-x [ -n "${TRAVIS:-}" ] && return - source /etc/os-release - - if [[ "${ID_LIKE:-}" =~ suse ]]; then + if [ -f "$sysconfig_docker_config_file" ]; then docker_config_file="$sysconfig_docker_config_file" + sed_script="s|^( *DOCKER_OPTS=.+--default-runtime[= ] *)[^ \"]+(.*\"$)|\1${name}\2|g" else docker_config_file="$systemd_docker_config_file" + sed_script="s/--default-runtime[= ][^ ]*/--default-runtime=${name}/g" fi - sudo -E sed -i "s/--default-runtime=[^ ][^ ]*/--default-runtime=${name}/g" \ - "${docker_config_file}" + sudo -E sed -i -E "$sed_script" "$docker_config_file" sudo -E systemctl daemon-reload sudo -E systemctl restart docker }