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}')
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)
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='/')
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,
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,
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,
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
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,
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,
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