Vagrant: Make F21 fixup conditional

The default Fedora 21 image requires some manual networking fixup that
breaks Fedora 22.  This change ensures that the fixup in question is run
only for Fedora 21.
This commit is contained in:
Maru Newby
2015-07-01 11:16:20 -07:00
parent e3afa2da7a
commit 4711eff229
2 changed files with 21 additions and 17 deletions

View File

@@ -21,15 +21,17 @@ set -e
# See: https://github.com/mitchellh/vagrant/issues/2430 # See: https://github.com/mitchellh/vagrant/issues/2430
hostnamectl set-hostname ${MASTER_NAME} hostnamectl set-hostname ${MASTER_NAME}
# Workaround to vagrant inability to guess interface naming sequence if [[ "$(grep 'VERSION_ID' /etc/os-release)" =~ ^VERSION_ID=21 ]]; then
# Tell system to abandon the new naming scheme and use eth* instead # Workaround to vagrant inability to guess interface naming sequence
rm -f /etc/sysconfig/network-scripts/ifcfg-enp0s3 # Tell system to abandon the new naming scheme and use eth* instead
rm -f /etc/sysconfig/network-scripts/ifcfg-enp0s3
# Disable network interface being managed by Network Manager (needed for Fedora 21+) # Disable network interface being managed by Network Manager (needed for Fedora 21+)
NETWORK_CONF_PATH=/etc/sysconfig/network-scripts/ NETWORK_CONF_PATH=/etc/sysconfig/network-scripts/
grep -q ^NM_CONTROLLED= ${NETWORK_CONF_PATH}ifcfg-eth1 || echo 'NM_CONTROLLED=no' >> ${NETWORK_CONF_PATH}ifcfg-eth1 grep -q ^NM_CONTROLLED= ${NETWORK_CONF_PATH}ifcfg-eth1 || echo 'NM_CONTROLLED=no' >> ${NETWORK_CONF_PATH}ifcfg-eth1
sed -i 's/^#NM_CONTROLLED=.*/NM_CONTROLLED=no/' ${NETWORK_CONF_PATH}ifcfg-eth1 sed -i 's/^#NM_CONTROLLED=.*/NM_CONTROLLED=no/' ${NETWORK_CONF_PATH}ifcfg-eth1
systemctl restart network systemctl restart network
fi
function release_not_found() { function release_not_found() {
echo "It looks as if you don't have a compiled version of Kubernetes. If you" >&2 echo "It looks as if you don't have a compiled version of Kubernetes. If you" >&2

View File

@@ -72,15 +72,17 @@ EOF
# See: https://github.com/mitchellh/vagrant/issues/2430 # See: https://github.com/mitchellh/vagrant/issues/2430
hostnamectl set-hostname ${MINION_NAME} hostnamectl set-hostname ${MINION_NAME}
# Workaround to vagrant inability to guess interface naming sequence if [[ "$(grep 'VERSION_ID' /etc/os-release)" =~ ^VERSION_ID=21 ]]; then
# Tell system to abandon the new naming scheme and use eth* instead # Workaround to vagrant inability to guess interface naming sequence
rm -f /etc/sysconfig/network-scripts/ifcfg-enp0s3 # Tell system to abandon the new naming scheme and use eth* instead
rm -f /etc/sysconfig/network-scripts/ifcfg-enp0s3
# Disable network interface being managed by Network Manager (needed for Fedora 21+) # Disable network interface being managed by Network Manager (needed for Fedora 21+)
NETWORK_CONF_PATH=/etc/sysconfig/network-scripts/ NETWORK_CONF_PATH=/etc/sysconfig/network-scripts/
grep -q ^NM_CONTROLLED= ${NETWORK_CONF_PATH}ifcfg-eth1 || echo 'NM_CONTROLLED=no' >> ${NETWORK_CONF_PATH}ifcfg-eth1 grep -q ^NM_CONTROLLED= ${NETWORK_CONF_PATH}ifcfg-eth1 || echo 'NM_CONTROLLED=no' >> ${NETWORK_CONF_PATH}ifcfg-eth1
sed -i 's/^#NM_CONTROLLED=.*/NM_CONTROLLED=no/' ${NETWORK_CONF_PATH}ifcfg-eth1 sed -i 's/^#NM_CONTROLLED=.*/NM_CONTROLLED=no/' ${NETWORK_CONF_PATH}ifcfg-eth1
systemctl restart network systemctl restart network
fi
# Setup hosts file to support ping by hostname to master # Setup hosts file to support ping by hostname to master
if [ ! "$(cat /etc/hosts | grep $MASTER_NAME)" ]; then if [ ! "$(cat /etc/hosts | grep $MASTER_NAME)" ]; then