Bug 1977: FSMongo Reverse Sync 38/11838/2
authorbeierlm <mark.beierl@canonical.com>
Mon, 4 Apr 2022 15:44:03 +0000 (11:44 -0400)
committerbeierlm <mark.beierl@canonical.com>
Mon, 4 Apr 2022 18:43:13 +0000 (14:43 -0400)
Directories represented by a symlink are not stored properly on reverse
sync, resulting in empty directories being created instead of preserving
the link

Fixes Bug 1977

Change-Id: Ia6a3b3dfdfde498751a79e04b2824ac38d0b7feb
Signed-off-by: beierlm <mark.beierl@canonical.com>
osm_common/fsmongo.py

index b04057e..487eaf8 100644 (file)
@@ -557,6 +557,8 @@ class FsMongo(FsBase):
         for root, dirs, files in os.walk(os_path):
             for folder in dirs:
                 member = {"filename": os.path.join(root, folder), "type": "dir"}
+                if os.path.islink(member["filename"]):
+                    member["type"] = "sym"
                 members.append(member)
             for file in files:
                 filename = os.path.join(root, file)