Skip to content

Commit

Permalink
Improve logging for canBackup check (#1142 #1143 #1328)
Browse files Browse the repository at this point in the history
Do not automatically log an error if the target drive is not accessible, as we might simply be waiting for it to come online. In turn, add a debug message to the 30s wait loop.
  • Loading branch information
emtiu committed Oct 7, 2022
1 parent 231eb59 commit da358a2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Upcoming Release
* Desktop integration: update .desktop file to mark Back In Time as a single main window program (#1258)
* Bugfix: AttributeError in "Diff Options" dialog (#898)
* Bugfix: Settings GUI: "Save password to Keyring" was disabled due to "no appropriate keyring found" (#1321)
* Bugfix: Avoid logging errors while waiting for a target drive to be mounted (#1142, #1143, #1328)
* Documentation update: correct description of profile<N>.schedule.time in backintime-config manpage (#1270)
* Translation update: Brazilian Portuguese (#1267)
* Translation update: Italian (#1110, #1123)
Expand Down
12 changes: 8 additions & 4 deletions common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1376,10 +1376,14 @@ def canBackup(self, profile_id = None):
if not self.isConfigured(profile_id):
return False

if not os.path.isdir(self.snapshotsFullPath(profile_id)):
logger.error("%s does not exist"
%self.snapshotsFullPath(profile_id),
self)
path = self.snapshotsFullPath(profile_id)

if not os.path.exists(path):
return False

if not os.path.isdir(path):
# path exists, but is no dir: something's very wrong.
logger.error("%s is not a directory"%path, self)
return False

return True
Expand Down
1 change: 1 addition & 0 deletions common/snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,7 @@ def backup(self, force = False):
gettext.ngettext('Waiting %s second.', 'Waiting %s seconds.', 30) % 30,
30)
for counter in range(30, 0, -1):
logger.info("Cannot start snapshot yet: target directory not accessible. Waiting 1s.")
time.sleep(1)
if self.config.canBackup():
break
Expand Down

0 comments on commit da358a2

Please sign in to comment.