From c8a09b344bb813f3ca1cd303cf58aa7034c973e0 Mon Sep 17 00:00:00 2001 From: Markus Kern Date: Tue, 10 Dec 2013 20:04:36 +0000 Subject: [PATCH] guests/redhat: Don't error if ifdown fails [GH-2614] --- plugins/guests/redhat/cap/configure_networks.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/guests/redhat/cap/configure_networks.rb b/plugins/guests/redhat/cap/configure_networks.rb index 27488184767..8540e7018b4 100644 --- a/plugins/guests/redhat/cap/configure_networks.rb +++ b/plugins/guests/redhat/cap/configure_networks.rb @@ -21,10 +21,10 @@ def self.configure_networks(machine, networks) networks.each do |network| interfaces.add(network[:interface]) - # Down the interface before munging the config file - retryable(:on => Vagrant::Errors::VagrantError, :tries => 3, :sleep => 2) do - machine.communicate.sudo("/sbin/ifdown eth#{network[:interface]} 2> /dev/null") - end + # Down the interface before munging the config file. This might fail + # if the interface is not actually set up yet so ignore errors. + machine.communicate.sudo( + "/sbin/ifdown eth#{network[:interface]} 2> /dev/null", error_check: false) # Remove any previous vagrant configuration in this network interface's # configuration files. @@ -52,7 +52,7 @@ def self.configure_networks(machine, networks) interfaces.each do |interface| retryable(:on => Vagrant::Errors::VagrantError, :tries => 3, :sleep => 2) do # The interface should already be down so this probably - # won't do anything, so we run it with error_check false.j + # won't do anything, so we run it with error_check false. machine.communicate.sudo( "/sbin/ifdown eth#{interface} 2> /dev/null", error_check: false)