From 2abd3dde7758c5e33c3abee4293efa433a294d7a Mon Sep 17 00:00:00 2001 From: Wainer dos Santos Moschetta Date: Tue, 31 Aug 2021 14:38:37 -0300 Subject: [PATCH] vagrantfile: Move IPv6 enabler to the setup script The code that enable IPv6 was moved from the Vagrantfile to .ci/setup_env_ubuntu.sh so that the environment can be setup correctly even if not on a vagrant box. The following line was dropped because I don't think it's worth to change the developer's environment permanently: `sudo sed -i 's/\(net.ipv6.conf.all.disable_ipv6\).*/\1=0/' /etc/sysctl.conf` Signed-off-by: Wainer dos Santos Moschetta --- .ci/setup_env_ubuntu.sh | 6 ++++++ Vagrantfile | 12 ------------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/.ci/setup_env_ubuntu.sh b/.ci/setup_env_ubuntu.sh index 10e355098a..15661dbefb 100755 --- a/.ci/setup_env_ubuntu.sh +++ b/.ci/setup_env_ubuntu.sh @@ -102,6 +102,12 @@ main() pkgs_to_install+=" ${rust_agent_pkgs[@]}" fi + # The redis-server package fails to install if IPv6 is disabled. Let's + # check if that's the case and then enable it. + if [[ $(sudo sysctl -n net.ipv6.conf.all.disable_ipv6) -eq 1 ]]; then + sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0 + fi + chronic sudo -E apt -y install $pkgs_to_install [ "$setup_type" = "minimal" ] && exit 0 diff --git a/Vagrantfile b/Vagrantfile index 03614b9100..e573fbed54 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -71,18 +71,6 @@ EOF echo "cd $kata_tests_repo_dir" >> #{guest_home_dir}/.bashrc sudo -E PATH=$PATH -u #{guest_user} \ echo "source $env_file" >> #{guest_home_dir}/.bashrc - - distro=$(source /etc/os-release; echo $ID) - case "$distro" in - "ubuntu") - # TODO: redis-server package fails to install if IPv6 is disabled. Move this - # code to the setup script. - if [[ $(sysctl -n net.ipv6.conf.all.disable_ipv6) -eq 1 ]]; then - sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0 - sudo sed -i 's/\(net.ipv6.conf.all.disable_ipv6\).*/\1=0/' /etc/sysctl.conf - fi - ;; - esac SHELL config.vm.define "fedora", autostart: false do |fedora|