Skip to content

Commit

Permalink
fix(profile sync): force copy if sync_mode is overwirte
Browse files Browse the repository at this point in the history
  • Loading branch information
jmkerloch committed Sep 5, 2024
1 parent 6e4ac79 commit 4bc2d2d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions qgis_deployment_toolbelt/jobs/job_profiles_synchronizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,9 @@ def sync_installed_profiles_from_downloaded_profiles(
"Installed profiles are going to be overridden by downloaded ones."
)
# copy all downloaded profiles
self.sync_overwrite_local_profiles(profiles_to_copy=downloaded_profiles)
self.sync_overwrite_local_profiles(
profiles_to_copy=downloaded_profiles, overwrite=True
)

else:
logger.debug(
Expand All @@ -262,17 +264,18 @@ def sync_installed_profiles_from_downloaded_profiles(
)

def sync_overwrite_local_profiles(
self, profiles_to_copy: tuple[QdtProfile]
self, profiles_to_copy: tuple[QdtProfile], overwrite: bool = False
) -> None:
"""Overwrite local profiles with downloaded ones.
Args:
profiles_to_copy (tuple[QdtProfile]): tuple of profiles to copy
overwrite (bool): overwrite profile if it exists (default False)
"""

# copy downloaded profiles into this
for d in profiles_to_copy:
if d.path_in_qgis.exists():
if not overwrite and d.path_in_qgis.exists():
logger.info(f"Merging {d.folder} to {d.path_in_qgis}")
installed_profile = QdtProfile(folder=d.path_in_qgis)
d.merge_to(installed_profile)
Expand Down

0 comments on commit 4bc2d2d

Please sign in to comment.