diff --git a/heat_cfntools/cfntools/cfn_helper.py b/heat_cfntools/cfntools/cfn_helper.py
index 5b1bf02..e699e6e 100644
--- a/heat_cfntools/cfntools/cfn_helper.py
+++ b/heat_cfntools/cfntools/cfn_helper.py
@@ -429,10 +429,10 @@ class PackagesHandler(object):
                     installs.append(pkg)
                 elif rc > 0:
                     downgrades.append(pkg)
-            if installs:
-                RpmHelper.install(installs, rpms=False)
-            if downgrades:
-                RpmHelper.downgrade(downgrades)
+        if installs:
+            RpmHelper.install(installs, rpms=False)
+        if downgrades:
+            RpmHelper.downgrade(downgrades)
 
     def _handle_rpm_packages(self, packages):
         """Handle installation, upgrade, or downgrade of packages via rpm.
diff --git a/heat_cfntools/tests/test_cfn_helper.py b/heat_cfntools/tests/test_cfn_helper.py
index 830ab5c..e42f774 100644
--- a/heat_cfntools/tests/test_cfn_helper.py
+++ b/heat_cfntools/tests/test_cfn_helper.py
@@ -87,10 +87,11 @@ class TestPackages(MockPopenTestCase):
                  'yum -y --showduplicates list available %s' % pack]) \
                 .AndReturn(FakePOpen(returncode=0))
             install_list.append(pack)
-            self.mock_cmd_run(
-                ['su', 'root', '-c',
-                 'yum -y install %s' % ' '.join(install_list)]) \
-                .AndReturn(FakePOpen(returncode=0))
+
+        self.mock_cmd_run(
+            ['su', 'root', '-c',
+             'yum -y install %s' % ' '.join(install_list)]) \
+            .AndReturn(FakePOpen(returncode=0))
 
         self.m.ReplayAll()
         packages = {