Merge pull request #2284 from pypeclub/bugfix/OP-2041_Alternate-site-for-Site-Sync-doesnt-work-for-sequences

Alternate site for site sync doesnt work for sequences
This commit is contained in:
Petr Kalis 2021-11-23 14:17:22 +01:00 committed by GitHub
commit c1d8245ff2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -421,7 +421,8 @@ class SFTPHandler(AbstractProvider):
try:
return pysftp.Connection(**conn_params)
except paramiko.ssh_exception.SSHException:
except (paramiko.ssh_exception.SSHException,
pysftp.exceptions.ConnectionException):
log.warning("Couldn't connect", exc_info=True)
def _mark_progress(self, collection, file, representation, server, site,

View file

@ -1574,6 +1574,7 @@ class SyncServerModule(OpenPypeModule, ITrayModule):
Use 'force' to remove existing or raises ValueError
"""
reseted_existing = False
for repre_file in representation.pop().get("files"):
if file_id and file_id != repre_file["_id"]:
continue
@ -1584,12 +1585,15 @@ class SyncServerModule(OpenPypeModule, ITrayModule):
self._reset_site_for_file(collection, query,
elem, repre_file["_id"],
site_name)
return
reseted_existing = True
else:
msg = "Site {} already present".format(site_name)
log.info(msg)
raise ValueError(msg)
if reseted_existing:
return
if not file_id:
update = {
"$push": {"files.$[].sites": elem}