From 059b48bfa28ae466d420fe15c8e6f686c93f1d6b Mon Sep 17 00:00:00 2001 From: Ganesh Maharaj Mahalingam Date: Sun, 17 Feb 2019 01:26:22 -0800 Subject: [PATCH] kata-deploy: Check crio conf before update kata-deploy inserts 'manage_network_ns_lifecycle' into crio.conf without any prior checks and if there is a previous entry in the file, this becomes a duplicate causing crio service restart issues. This patch addresses that particular scenario. Signed-off-by: Ganesh Maharaj Mahalingam --- kata-deploy/scripts/kata-deploy.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kata-deploy/scripts/kata-deploy.sh b/kata-deploy/scripts/kata-deploy.sh index c073e5a4ac..eeb3e64f53 100755 --- a/kata-deploy/scripts/kata-deploy.sh +++ b/kata-deploy/scripts/kata-deploy.sh @@ -65,7 +65,10 @@ function configure_crio() { runtime_path = "/opt/kata/bin/kata-fc" EOT - sed -i 's|\(\[crio\.runtime\]\)|\1\nmanage_network_ns_lifecycle = true|' "$crio_conf_file" + # Replace if exists, insert otherwise + grep -Fq 'manage_network_ns_lifecycle =' $crio_conf_file \ + && sed -i '/manage_network_ns_lifecycle =/c manage_network_ns_lifecycle = true' $crio_conf_file \ + || sed -i '/\[crio.runtime\]/a manage_network_ns_lifecycle = true' $crio_conf_file } function configure_containerd() {