]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
cephfs-shell: get cmd must get both path and should validate them
authordparmar18 <dparmar@redhat.com>
Fri, 8 Apr 2022 08:58:48 +0000 (14:28 +0530)
committerdparmar18 <dparmar@redhat.com>
Wed, 11 May 2022 11:46:28 +0000 (17:16 +0530)
commit689927b0e5d078fc16778ef4a144def7226f8a4c
treea53d1313bbe23575f0cb6c73e0f85dcec35ee189
parentaa9938aacb02ab010754241d468d34702be9e473
cephfs-shell: get cmd must get both path and should validate them

Description:
- While using `get` command, `local_path` parameter is optional. Changing it
  to mandatory.
  - Rationale: Till now, there used to be a default path of `local_path` as
               `default='.'` but wasn't mentioned anywhere. It led to confusion.
               On top of it, considering get command to be a ssh inspired utlity,
               or any other CLI tool that copies file between filesystems, source
               and destination path are always mandatory. Therefore in order to
               simulate this behavior in cephfs-shell`s command(s), my opinion is
               to make get command accept both the paths.

- Added checks to make sure:
1) File does exist at `remote_path`
2) File with the same name doesn't exist in `local_path`
3) Removed code that would run through the directory and if it finds
   nothing in `root_src_dir`, then it will try to do:
   `os.makedirs(root_dst_dir + b'/' + root_src_dir)`, but it will
   never be empty as 1) takes care of it.

Fixes: https://tracker.ceph.com/issues/55216
Signed-off-by: dparmar18 <dparmar@redhat.com>
src/tools/cephfs/cephfs-shell