ifdown ethN before munging ifcfg-ethN #2450
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a patch for issue #1577 (reported by @chorankates-sfdc)
If vagrant munges
ifcfg-ethN
by removing the previous vagrant config for the interface before callingifdown
, all boxes after the first may encounter an ip address collision as noted here. The simplest fix is to ensure that base boxes contain NO vagrant configured interfaces. However, a more generic solution is simply to callifdown
before mungingifcfg-ethN
.Vagrantfile
NOTE: I've intentionally left an
ifcfg-eth1
file in my base box. It looks like this:Using commit a92e03cf4ce936243d3959b7b5603262a234a58d
As noted in my comments here and here, the first box to the upped retains the ip address as specified by my stray
ifcfg-eth1
(even though an updatedifcfg-eth1
has been pushed by vagrant). The second box picks up the correct ip address as specified in theVagrantfile
.$ VAGRANT_LOG=debug bundle exec bin/vagrant up web db
web
/var/log/boot.log
/var/log/messages
db
/var/log/boot.log
/var/log/messages
Using this patch 1ad756d52c05a3732ff06e642b12a3e664b41743
Both hosts come up with the ip addresses as specified in the
Vagrantfile
.$ VAGRANT_LOG=debug bundle exec bin/vagrant up web db
web
/var/log/boot.log
/var/log/messages
db
/var/log/boot.log
/var/log/messages