Merge pull request #7926 from chrisroberts/networking/rhel

guests/redhat: Force NetworkManager to reload device configurations
This commit is contained in:
Chris Roberts 2016-10-25 14:41:07 -07:00 committed by GitHub
commit 365b98fee6
2 changed files with 6 additions and 7 deletions

View File

@ -40,13 +40,11 @@ module VagrantPlugins
# Down the interface before munging the config file. This might
# fail if the interface is not actually set up yet so ignore
# errors.
/sbin/ifdown '#{network[:device]}' || true
/sbin/ifdown '#{network[:device]}'
# Move new config into place
mv -f '#{remote_path}' '#{final_path}'
# Bring the interface up
ARPCHECK=no /sbin/ifup '#{network[:device]}'
# attempt to force network manager to reload configurations
nmcli c reload || true
EOH
end

View File

@ -56,9 +56,10 @@ describe "VagrantPlugins::GuestRedHat::Cap::ConfigureNetworks" do
cap.configure_networks(machine, [network_1, network_2])
expect(comm.received_commands[0]).to match(/\/sbin\/ifdown 'eth1'/)
expect(comm.received_commands[0]).to match(/\/sbin\/ifup 'eth1'/)
expect(comm.received_commands[0]).to match(/ifcfg-eth1/)
expect(comm.received_commands[0]).to match(/\/sbin\/ifdown 'eth2'/)
expect(comm.received_commands[0]).to match(/\/sbin\/ifup 'eth2'/)
expect(comm.received_commands[0]).to match(/ifcfg-eth2/)
expect(comm.received_commands[0]).to match(/nmcli c reload/)
end
end
end