MCPcopy Create free account
hub / github.com/ceph/ceph / read_file

Method read_file

qa/tasks/cephfs/mount.py:759–777  ·  view source on GitHub ↗

Return the data from the file on given path.

(self, path, sudo=False, offset=None, length=None)

Source from the content-addressed store, hash-verified

757 self.run_shell(args=f'chmod {perms} {path}')
758
759 def read_file(self, path, sudo=False, offset=None, length=None):
760 """
761 Return the data from the file on given path.
762 """
763 if path.find(self.hostfs_mntpt) == -1:
764 path = os.path.join(self.hostfs_mntpt, path)
765
766 args = []
767 if sudo:
768 args.append('sudo')
769 args.append('dd')
770 args.append(f'if={path}')
771 args.append('bs=1')
772 if offset:
773 args.append(f'skip={offset}')
774 if length:
775 args.append(f'count={length}')
776
777 return self.run_shell(args=args, omit_sudo=False).stdout.getvalue().strip()
778
779 def create_destroy(self):
780 assert(self.is_mounted())

Callers 15

_run_testsFunction · 0.45
write_mtls_configMethod · 0.45
clusterFunction · 0.45
run_daemonFunction · 0.45
taskFunction · 0.45
ceph_bootstrapFunction · 0.45
preflightFunction · 0.45
kubectl_configFunction · 0.45
setup_pvsFunction · 0.45
rook_operatorFunction · 0.45
rook_clusterFunction · 0.45
read_resultsMethod · 0.45

Calls 4

run_shellMethod · 0.95
findMethod · 0.45
joinMethod · 0.45
appendMethod · 0.45