From: Rishabh Dave Date: Thu, 8 Apr 2021 06:30:18 +0000 (+0530) Subject: qa/cephfs: remove create_keyring_file from cephfs_test_case.py X-Git-Tag: v17.1.0~2303^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=511434ac5ad050dafee50c82c312eeec8270585a;p=ceph-ci.git qa/cephfs: remove create_keyring_file from cephfs_test_case.py Since teuthology.orchestra.remote.mktemp() can write a temporary file and not just create it, create_keyring_file() is now redundant. Signed-off-by: Rishabh Dave --- diff --git a/qa/tasks/cephfs/caps_helper.py b/qa/tasks/cephfs/caps_helper.py index a6633354623..e27a3e1b35c 100644 --- a/qa/tasks/cephfs/caps_helper.py +++ b/qa/tasks/cephfs/caps_helper.py @@ -8,7 +8,7 @@ from teuthology.orchestra.run import Raw class CapsHelper(CephFSTestCase): def run_mon_cap_tests(self, moncap, keyring): - keyring_path = self.create_keyring_file(self.fs.admin_remote, keyring) + keyring_path = self.fs.admin_remote.mktemp(data=keyring) fsls = self.run_cluster_cmd(f'fs ls --id {self.client_id} -k ' f'{keyring_path}') diff --git a/qa/tasks/cephfs/cephfs_test_case.py b/qa/tasks/cephfs/cephfs_test_case.py index 816ddcc1e7b..1a1cf40517a 100644 --- a/qa/tasks/cephfs/cephfs_test_case.py +++ b/qa/tasks/cephfs/cephfs_test_case.py @@ -442,6 +442,3 @@ class CephFSTestCase(CephTestCase): self.run_cluster_cmd(cmd) return self.run_cluster_cmd(f'auth get {self.client_name}') - - def create_keyring_file(self, remote, keyring): - return remote.mktemp(data=keyring) diff --git a/qa/tasks/cephfs/test_admin.py b/qa/tasks/cephfs/test_admin.py index 9513a84b767..ae6cd6e7be6 100644 --- a/qa/tasks/cephfs/test_admin.py +++ b/qa/tasks/cephfs/test_admin.py @@ -481,8 +481,7 @@ class TestSubCmdFsAuthorize(CapsHelper): self.mount_a.write_file(filepath, filedata) keyring = self.fs.authorize(self.client_id, ('/', 'rw', 'root_squash')) - keyring_path = self.create_keyring_file(self.mount_a.client_remote, - keyring) + keyring_path = self.mount_a.client_remote.mktemp(data=keyring) self.mount_a.remount(client_id=self.client_id, client_keyring_path=keyring_path, cephfs_mntpt='/') @@ -517,8 +516,7 @@ class TestSubCmdFsAuthorize(CapsHelper): filepaths, filedata, mounts, keyring = self.setup_test_env(perm, paths) moncap = self.get_mon_cap_from_keyring(self.client_name) - keyring_path = self.create_keyring_file(self.mount_a.client_remote, - keyring) + keyring_path = self.mount_a.client_remote.mktemp(data=keyring) for path in paths: self.mount_a.remount(client_id=self.client_id, client_keyring_path=keyring_path, @@ -534,8 +532,7 @@ class TestSubCmdFsAuthorize(CapsHelper): filepaths, filedata, mounts, keyring = self.setup_test_env(perm, paths) moncap = self.get_mon_cap_from_keyring(self.client_name) - keyring_path = self.create_keyring_file(self.mount_a.client_remote, - keyring) + keyring_path = self.mount_a.client_remote.mktemp(data=keyring) for path in paths: self.mount_a.remount(client_id=self.client_id, client_keyring_path=keyring_path, @@ -559,8 +556,7 @@ class TestSubCmdFsAuthorize(CapsHelper): self.mount_a.write_file(filepath, filedata) keyring = self.fs.authorize(self.client_id, ('/', perm)) - keyring_path = self.create_keyring_file(self.mount_a.client_remote, - keyring) + keyring_path = self.mount_a.client_remote.mktemp(data=keyring) self.mount_a.remount(client_id=self.client_id, client_keyring_path=keyring_path, diff --git a/qa/tasks/cephfs/test_multifs_auth.py b/qa/tasks/cephfs/test_multifs_auth.py index b247dd8f51b..f4c9b9e8707 100644 --- a/qa/tasks/cephfs/test_multifs_auth.py +++ b/qa/tasks/cephfs/test_multifs_auth.py @@ -179,8 +179,7 @@ class TestMDSCaps(TestMultiFS): keyring = self.create_client(self.client_id, moncap, osdcap, mdscap) keyring_paths = [] for mount_x in (self.mount_a, self.mount_b): - keyring_paths.append(self.create_keyring_file( - mount_x.client_remote, keyring)) + keyring_paths.append(mount_x.client_remote.mktemp(data=keyring)) return keyring_paths @@ -275,8 +274,7 @@ class TestClientsWithoutAuth(TestMultiFS): def test_mount_all_caps_absent(self): # setup part... keyring = self.fs1.authorize(self.client_id, ('/', 'rw')) - keyring_path = self.create_keyring_file(self.mount_a.client_remote, - keyring) + keyring_path = self.mount_a.client_remote.mktemp(data=keyring) # mount the FS for which client has no auth... retval = self.mount_a.remount(client_id=self.client_id, @@ -297,8 +295,7 @@ class TestClientsWithoutAuth(TestMultiFS): osdcap = (f'allow rw tag cephfs data={self.fs1.name}, allow rw tag ' f'cephfs data={self.fs2.name}') keyring = self.create_client(self.client_id, moncap, osdcap, mdscap) - keyring_path = self.create_keyring_file(self.mount_a.client_remote, - keyring) + keyring_path = self.mount_a.client_remote.mktemp(data=keyring) # mount the FS for which client has no auth... retval = self.mount_a.remount(client_id=self.client_id, diff --git a/qa/tasks/vstart_runner.py b/qa/tasks/vstart_runner.py index 586ecf71d5d..efa49269df2 100644 --- a/qa/tasks/vstart_runner.py +++ b/qa/tasks/vstart_runner.py @@ -316,6 +316,8 @@ class LocalRemote(object): from tempfile import mktemp if not path: path = mktemp(suffix=suffix, dir=parentdir) + if not parentdir: + path = os.path.join('/tmp', path) if data: # sudo is set to False since root user can't write files in /tmp