From d1bf79b81399572b68a8b80b159ee92ff75d8ac5 Mon Sep 17 00:00:00 2001
From: Emilien Macchi <emilien@redhat.com>
Date: Tue, 29 Sep 2015 13:59:17 -0400
Subject: [PATCH] Cleanup some legacy code

* Stop setting SElinux as permissive and bring it to 'enforced' again,
  since our blocker is fixed [1].
* Run `apt-get update` only in run_tests.sh script. It's the only place
  we actually need to run it since beaker jobs already manage that task.
* in run_tests.sh, use $SUDO instead of sudo, to be consistent.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1249685

Change-Id: Ic3101a0a080b798b334cd2f212ec726f243880b5
---
 install_modules.sh | 14 --------------
 run_tests.sh       |  8 +++++---
 2 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/install_modules.sh b/install_modules.sh
index c2aace3e4..76e70720e 100755
--- a/install_modules.sh
+++ b/install_modules.sh
@@ -52,17 +52,3 @@ else
 fi
 
 puppet module list
-
-if type "apt-get" 2>/dev/null; then
-    # apt-get update needs to be run to be able (later) to install
-    # ubuntu-cloud-keyring package with puppet
-    /usr/bin/apt-get update
-else
-    # disable SElinux
-    # something is python-cffi is preventing Nova & Keystone to
-    # correctly run when SElinux is enforced. See bug:
-    # https://bugzilla.redhat.com/show_bug.cgi?id=1249685
-    # We use || true because if selinux is Disabled the following
-    # command would fail
-    /usr/sbin/setenforce 0 || true
-fi
diff --git a/run_tests.sh b/run_tests.sh
index 431bb4e32..79db88be4 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -19,6 +19,7 @@ if [ $(id -u) != 0 ]; then
 fi
 
 $SUDO ./install_modules.sh
+
 # TODO(pabelanger): Move this into tools/install_tempest.sh and add logic so we
 # can clone tempest outside of the gate. Also, tempest should be sandboxed into
 # the local directory but works needs to be added into puppet to properly find
@@ -51,14 +52,15 @@ function uses_debs {
 }
 
 if uses_debs; then
-    sudo apt-get install -y dstat
+    $SUDO apt-get update
+    $SUDO apt-get install -y dstat
 elif is_fedora; then
-    sudo yum install -y dstat
+    $SUDO yum install -y dstat
 fi
 
 # use dstat to monitor system activity during integration testing
 if type "dstat" 2>/dev/null; then
-  $SUDO dstat -tcmndrylpg --top-cpu-adv --top-io-adv --nocolor | sudo tee --append /var/log/dstat.log > /dev/null &
+  $SUDO dstat -tcmndrylpg --top-cpu-adv --top-io-adv --nocolor | $SUDO tee --append /var/log/dstat.log > /dev/null &
 fi
 
 # Run puppet and assert something changes.