Skip to content

Commit

Permalink
fix: SyncDirectory Prediction
Browse files Browse the repository at this point in the history
Add a check to the SyncDirectory component for the target directory.

The SyncDirectory component `verify()` stage fails when the target
directory does not exist yet, because it uses rsync to determine if there
is a diff between left and right. In cases where the target directory
is part of the deployment and has thusly not been created yet, this
leads to unexpected errors.
  • Loading branch information
PhilTaken committed Nov 28, 2023
1 parent 819b404 commit 854fef7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
bubbled incorrectly and caused spurious deployment errors.
- Add new `rsync-ext` repository type which uses an external rsync
binary for repository synchronisation.
- Fix bug where the SyncDirectory component errors out because the target directory
does not exist yet.


## 2.4rc1 (2023-09-12)
Expand Down
3 changes: 3 additions & 0 deletions src/batou/lib/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ def exclude_arg(self):
return " ".join("--exclude '{}'".format(x) for x in self.exclude) + " "

def verify(self):
if not os.path.isdir(self.path):
raise batou.UpdateNeeded()

stdout, stderr = self.cmd(
"rsync {} {}{}/ {}".format(
self.verify_opts, self.exclude_arg, self.source, self.path
Expand Down

0 comments on commit 854fef7

Please sign in to comment.