]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tasks/cephfs: clear extra auth ids on test start
authorJohn Spray <john.spray@redhat.com>
Mon, 9 Nov 2015 13:16:36 +0000 (13:16 +0000)
committerJohn Spray <john.spray@redhat.com>
Thu, 14 Jan 2016 22:55:29 +0000 (22:55 +0000)
Because new volumeclient tests will be creating IDs
instead of modifying the default ones.

Signed-off-by: John Spray <john.spray@redhat.com>
tasks/cephfs/cephfs_test_case.py

index 500cd765589d272f55f93c1d8773cf83a4350aac..98ca5fdb5b7b59cc6d910beecce603830648adb5 100644 (file)
@@ -132,13 +132,21 @@ class CephFSTestCase(unittest.TestCase):
             self.fs.mon_manager.raw_cluster_cmd("osd", "blacklist", "rm", addr)
 
         # In case some test messed with auth caps, reset them
-        for mount in self.mounts:
+        client_mount_ids = [m.client_id for m in self.mounts]
+        for client_id in client_mount_ids:
             self.fs.mon_manager.raw_cluster_cmd_result(
-                'auth', 'caps', "client.{0}".format(mount.client_id),
+                'auth', 'caps', "client.{0}".format(client_id),
                 'mds', 'allow',
                 'mon', 'allow r',
                 'osd', 'allow rw pool={0}'.format(self.fs.get_data_pool_name()))
 
+        # In case there were any extra auth identities around from a previous
+        # test, delete them
+        for entry in self.auth_list():
+            ent_type, ent_id = entry['entity'].split(".")
+            if ent_type == "client" and ent_id not in client_mount_ids and ent_id != "admin":
+                self.fs.mon_manager.raw_cluster_cmd("auth", "del", entry['entity'])
+
         self.fs.mds_restart()
         self.fs.wait_for_daemons()
         if not self.mount_a.is_mounted():