Move run_ssh class variable into skip decorators

We shouldn't do a getattr on CONF in the class definition. It will cause
import errors if there isn't a config file. Just use
CONF.compute.run_ssh in the skip decorator.

Change-Id: I948ac411d4af9844f2c69fb91f7c0fdc3aaf7fe4
diff --git a/tempest/api/compute/servers/test_create_server.py b/tempest/api/compute/servers/test_create_server.py
index 778294e..f0a8c8d 100644
--- a/tempest/api/compute/servers/test_create_server.py
+++ b/tempest/api/compute/servers/test_create_server.py
@@ -28,7 +28,6 @@
 
 
 class ServersTestJSON(base.BaseV2ComputeTest):
-    run_ssh = CONF.compute.run_ssh
     disk_config = 'AUTO'
 
     @classmethod
@@ -89,7 +88,8 @@
         found = any([i for i in servers if i['id'] == self.server['id']])
         self.assertTrue(found)
 
-    @testtools.skipIf(not run_ssh, 'Instance validation tests are disabled.')
+    @testtools.skipUnless(CONF.compute.run_ssh,
+                          'Instance validation tests are disabled.')
     @test.attr(type='gate')
     def test_verify_created_server_vcpus(self):
         # Verify that the number of vcpus reported by the instance matches
@@ -99,7 +99,8 @@
                                                   self.password)
         self.assertEqual(flavor['vcpus'], linux_client.get_number_of_vcpus())
 
-    @testtools.skipIf(not run_ssh, 'Instance validation tests are disabled.')
+    @testtools.skipUnless(CONF.compute.run_ssh,
+                          'Instance validation tests are disabled.')
     @test.attr(type='gate')
     def test_host_name_is_same_as_server_name(self):
         # Verify the instance host name is the same as the server name
@@ -109,7 +110,6 @@
 
 
 class ServersWithSpecificFlavorTestJSON(base.BaseV2ComputeAdminTest):
-    run_ssh = CONF.compute.run_ssh
     disk_config = 'AUTO'
 
     @classmethod
@@ -135,7 +135,8 @@
         cls.client.wait_for_server_status(cls.server_initial['id'], 'ACTIVE')
         resp, cls.server = cls.client.get_server(cls.server_initial['id'])
 
-    @testtools.skipIf(not run_ssh, 'Instance validation tests are disabled.')
+    @testtools.skipUnless(CONF.compute.run_ssh,
+                          'Instance validation tests are disabled.')
     @test.attr(type='gate')
     def test_verify_created_server_ephemeral_disk(self):
         # Verify that the ephemeral disk is created when creating server
diff --git a/tempest/api/compute/v3/servers/test_attach_volume.py b/tempest/api/compute/v3/servers/test_attach_volume.py
index 8577aab..28d8517 100644
--- a/tempest/api/compute/v3/servers/test_attach_volume.py
+++ b/tempest/api/compute/v3/servers/test_attach_volume.py
@@ -24,7 +24,6 @@
 
 
 class AttachVolumeV3Test(base.BaseV3ComputeTest):
-    run_ssh = CONF.compute.run_ssh
 
     def __init__(self, *args, **kwargs):
         super(AttachVolumeV3Test, self).__init__(*args, **kwargs)
@@ -76,7 +75,7 @@
         self.attached = True
         self.addCleanup(self._detach, server['id'], volume['id'])
 
-    @testtools.skipIf(not run_ssh, 'SSH required for this test')
+    @testtools.skipUnless(CONF.compute.run_ssh, 'SSH required for this test')
     @test.attr(type='gate')
     def test_attach_detach_volume(self):
         # Stop and Start a server with an attached volume, ensuring that
diff --git a/tempest/api/compute/v3/servers/test_create_server.py b/tempest/api/compute/v3/servers/test_create_server.py
index 14a4338..80c40a2 100644
--- a/tempest/api/compute/v3/servers/test_create_server.py
+++ b/tempest/api/compute/v3/servers/test_create_server.py
@@ -28,7 +28,6 @@
 
 
 class ServersV3Test(base.BaseV3ComputeTest):
-    run_ssh = CONF.compute.run_ssh
     disk_config = 'AUTO'
 
     @classmethod
@@ -90,7 +89,8 @@
         found = any([i for i in servers if i['id'] == self.server['id']])
         self.assertTrue(found)
 
-    @testtools.skipIf(not run_ssh, 'Instance validation tests are disabled.')
+    @testtools.skipUnless(CONF.compute.run_ssh,
+                          'Instance validation tests are disabled.')
     @test.attr(type='gate')
     def test_verify_created_server_vcpus(self):
         # Verify that the number of vcpus reported by the instance matches
@@ -100,7 +100,8 @@
                                                   self.ssh_user, self.password)
         self.assertEqual(flavor['vcpus'], linux_client.get_number_of_vcpus())
 
-    @testtools.skipIf(not run_ssh, 'Instance validation tests are disabled.')
+    @testtools.skipUnless(CONF.compute.run_ssh,
+                          'Instance validation tests are disabled.')
     @test.attr(type='gate')
     def test_host_name_is_same_as_server_name(self):
         # Verify the instance host name is the same as the server name
@@ -110,7 +111,6 @@
 
 
 class ServersWithSpecificFlavorV3Test(base.BaseV3ComputeAdminTest):
-    run_ssh = CONF.compute.run_ssh
     disk_config = 'AUTO'
 
     @classmethod
@@ -136,7 +136,8 @@
         cls.client.wait_for_server_status(cls.server_initial['id'], 'ACTIVE')
         resp, cls.server = cls.client.get_server(cls.server_initial['id'])
 
-    @testtools.skipIf(not run_ssh, 'Instance validation tests are disabled.')
+    @testtools.skipUnless(CONF.compute.run_ssh,
+                          'Instance validation tests are disabled.')
     @test.attr(type='gate')
     def test_verify_created_server_ephemeral_disk(self):
         # Verify that the ephemeral disk is created when creating server
diff --git a/tempest/api/compute/volumes/test_attach_volume.py b/tempest/api/compute/volumes/test_attach_volume.py
index 3c5feed..ab9d144 100644
--- a/tempest/api/compute/volumes/test_attach_volume.py
+++ b/tempest/api/compute/volumes/test_attach_volume.py
@@ -24,7 +24,6 @@
 
 
 class AttachVolumeTestJSON(base.BaseV2ComputeTest):
-    run_ssh = CONF.compute.run_ssh
 
     def __init__(self, *args, **kwargs):
         super(AttachVolumeTestJSON, self).__init__(*args, **kwargs)
@@ -76,7 +75,7 @@
         self.attached = True
         self.addCleanup(self._detach, server['id'], volume['id'])
 
-    @testtools.skipIf(not run_ssh, 'SSH required for this test')
+    @testtools.skipUnless(CONF.compute.run_ssh, 'SSH required for this test')
     @test.attr(type='gate')
     def test_attach_detach_volume(self):
         # Stop and Start a server with an attached volume, ensuring that