Cleanup vagrant 94/994/1
authorAndrew Grimberg <[email protected]>
Wed, 4 May 2016 23:08:01 +0000 (16:08 -0700)
committerAndrew Grimberg <[email protected]>
Wed, 4 May 2016 23:08:01 +0000 (16:08 -0700)
* Cleanup the Vagrantfile of unneeded cruft
* Cleanup the boostrap to be a bit more quiet and also give context as
  to what it's doing
* Make sure that the reseal has a sync / sleep

Change-Id: Ia1aa4e30b7a6342689c6fce30a18db1f52d27182
Signed-off-by: Andrew Grimberg <[email protected]>
vagrant/basebuild/Vagrantfile
vagrant/basebuild/bootstrap.sh
vagrant/lib/system_reseal.sh

index 0ee17e0..37ce73f 100644 (file)
@@ -2,13 +2,6 @@
 # vi: set ts=2 sw=2 sts=2 et ft=ruby :\r
 \r
 Vagrant.configure(2) do |config|\r
-  # Fedora and EL systems default to requiring a tty for sudo\r
-  if (ENV['RSPTY'] == 'default')\r
-    config.ssh.pty = false\r
-  else\r
-    config.ssh.pty = true\r
-  end\r
-\r
   config.vm.provider :openstack do |os, override|\r
     config.vm.box = "dummy"\r
 \r
index 1921b9b..22c9a28 100644 (file)
@@ -4,12 +4,11 @@
 set -e
 
 # Redirect stdout ( 1> ) and stderr ( 2> ) into named pipes ( >() ) running "tee"
-exec 1> >(tee -i /tmp/bootstrap-out.log)
-exec 2> >(tee -i /tmp/bootstrap-err.log)
+#exec 1> >(tee -i /tmp/bootstrap-out.log)
+#exec 2> >(tee -i /tmp/bootstrap-err.log)
 
 ubuntu_systems() {
 
-    LSB_PATH=$(which lsb_release)
     PACKAGES="" # initialize PACKAGES
 
     if [ $? == 0 ]
@@ -19,19 +18,19 @@ ubuntu_systems() {
         CODENAME=$(lsb_release -c | awk '{print $2}')
     else
         ISSUE_TXT=$(head -1 /etc/issue)
-        DIST=$(echo ${ISSUE_TXT} | awk '{print $1}')
+        DIST=$(echo "${ISSUE_TXT}" | awk '{print $1}')
         if [ "$DIST" = "Ubuntu" ]
         then
-            VERSION=$(echo ${ISSUE_TXT} | awk '{print $2}' | sed -e 's/^(\d+\.\d+)(\.\d+)?$/\1/')
+            VERSION=$(echo "${ISSUE_TXT}" | awk '{print $2}' | sed -e 's/^(\d+\.\d+)(\.\d+)?$/\1/')
         elif [ "$DIST" = "Debian" ]
         then
-            VERSION=$(echo ${ISSUE_TXT} | awk '{print $3}')
+            VERSION=$(echo "${ISSUE_TXT}" | awk '{print $3}')
         else
             echo "Unrecognized distribution: ${DIST}"
         fi
     fi
 
-    echo "Detected [${DIST} v${VERSION} (${CODENAME})]"
+    echo "---> Detected [${DIST} v${VERSION} (${CODENAME})]"
 
     export DEBIAN_FRONTEND=noninteractive
     cat <<EOF >> /etc/apt/apt.conf
@@ -73,10 +72,11 @@ EOF
     fi
 
 
+    echo '---> Updating OS'
     # Standard update + upgrade dance
-    apt-get update
-    apt-get upgrade
-    apt-get dist-upgrade
+    apt-get -qq update
+    apt-get -qq upgrade
+    apt-get -qq dist-upgrade
 
     # Fix the silly notion that /bin/sh should point to dash by pointing it to bash
 
@@ -100,11 +100,15 @@ EOF
     # Install virtualenv for test execution
     PACKAGES="$PACKAGES python-virtualenv python-pip python-dev"
 
-    apt-get install ${PACKAGES}
-    apt-get autoremove
-    apt-get clean
+    echo '---> Installing packages'
+    # disable double quoting check
+    # shellcheck disable=SC2086 
+    apt-get -qq install ${PACKAGES}
+    apt-get -qq autoremove
+    apt-get -qq clean
 
     # update CA certificates
+    echo '---> Forcing CA certificate update'
     update-ca-certificates -f
 
     # It is not necessary to load the uio kernel module during the bootstrap phase
@@ -123,31 +127,33 @@ EOF
 }
 
 rh_systems() {
-    # Install build tools
-    yum groupinstall 'Development Tools' -y
-    yum install openssl-devel -y
-    yum install glibc-static -y
+    echo '---> Updating OS'
+    yum clean all -q
+    yum upgrade -q -y
+
+    echo '---> Installing tools'
+    yum install -q -y @development openssl-devel glibc-static
 
     # Install jdk and maven
-    yum install -y java-1.8.0-openjdk-devel
+    yum install -q -y java-1.8.0-openjdk-devel
 
     # Install python development
     yum search python34-devel 2>&1 | grep -q 'No matches'
     if [ $? -eq 0 ]
     then
-        yum install -y python-devel
+       echo '---> Installing python-devel'
+        yum install -q -y python-devel
     else
-        yum install -y python34-devel
+       echo '---> Installying python34-devel'
+        yum install -q -y python34-devel
     fi
 
+    echo '---> Configuring EPEL'
     # Install EPEL
-    yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
+    yum install -q -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
 
     # Install components to build Ganglia modules
-    yum install -y apr-devel
-    yum install -y --enablerepo=epel libconfuse-devel
-    yum install -y --enablerepo=epel ganglia-devel
-    yum install -y --enablerepo=epel mock
+    yum install -q -y {apr,libconfuse,ganglia}-devel mock
 }
 
 echo "---> Attempting to detect OS"
@@ -175,7 +181,7 @@ esac
 
 echo "bootstrap process (PID=$$) complete."
 
-exec 1>&- # close STDOUT
-exec 2>&- # close STDERR
+#exec 1>&- # close STDOUT
+#exec 2>&- # close STDERR
 
 exit 0
index 32dbc44..360af59 100644 (file)
@@ -11,9 +11,6 @@ if [ -f /.autorelabel ]; then
   exit 1;
 fi
 
-# clean-up from any prior cloud-init networking
-#rm -rf /etc/sysconfig/network-scripts/ifcfg-eth*
-
 rm -rf /etc/Pegasus/*.cnf /etc/Pegasus/*.crt /etc/Pegasus/*.csr /etc/Pegasus/*.pem /etc/Pegasus/*.srl /root/anaconda-ks.cfg /root/anaconda-post.log /root/initial-setup-ks.cfg /root/install.log /root/install.log.syslog /var/cache/fontconfig/* /var/cache/gdm/* /var/cache/man/* /var/lib/AccountService/users/* /var/lib/fprint/* /var/lib/logrotate.status /var/log/*.log* /var/log/BackupPC/LOG /var/log/ConsoleKit/* /var/log/anaconda.syslog /var/log/anaconda/* /var/log/apache2/*_log /var/log/apache2/*_log-* /var/log/apt/* /var/log/aptitude* /var/log/audit/* /var/log/btmp* /var/log/ceph/*.log /var/log/chrony/*.log /var/log/cron* /var/log/cups/*_log /var/log/debug* /var/log/dmesg* /var/log/exim4/* /var/log/faillog* /var/log/gdm/* /var/log/glusterfs/*glusterd.vol.log /var/log/glusterfs/glusterfs.log /var/log/httpd/*log /var/log/installer/* /var/log/jetty/jetty-console.log /var/log/journal/* /var/log/lastlog* /var/log/libvirt/libvirtd.log /var/log/libvirt/lxc/*.log /var/log/libvirt/qemu/*.log /var/log/libvirt/uml/*.log /var/log/lightdm/* /var/log/mail/* /var/log/maillog* /var/log/messages* /var/log/ntp /var/log/ntpstats/* /var/log/ppp/connect-errors /var/log/rhsm/* /var/log/sa/* /var/log/secure* /var/log/setroubleshoot/*.log /var/log/spooler* /var/log/squid/*.log /var/log/syslog* /var/log/tallylog* /var/log/tuned/tuned.log /var/log/wtmp* /var/named/data/named.run
 
 rm -rf ~/.viminfo /etc/ssh/ssh*key* ~/.ssh/* /root/.ssh/*
@@ -21,24 +18,14 @@ rm -rf ~/.viminfo /etc/ssh/ssh*key* ~/.ssh/* /root/.ssh/*
 # kill any cloud-init related bits
 rm -rf /var/lib/cloud/*
 
-#if [ -e /usr/bin/facter ]
-#then
-#  if [ `/usr/bin/facter operatingsystem` = 'Ubuntu' ]
-#  then
-#    rm -rf /etc/hostname* /etc/hosts /etc/network/interfaces /etc/network/interfaces.*.bak~
-#    cat <<EOINT >> /etc/network/interfaces
-## Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
-## /usr/share/doc/ifupdown/examples for more information.
-## The loopback network interface
-#auto lo
-#iface lo inet loopback
-#EOINT
-#  fi
-#fi
-
 # cleanup /vagrant
 rm -rf /vagrant
 
+# Force a system sync and sleep to get around any SSD issues
+echo "Forcing sync and sleep for 10sec"
+sync
+sleep 10
+
 echo "********************************************"
 echo "*   PLEASE SNAPSHOT IMAGE AT THIS TIME     *"
 echo "********************************************"