X-Git-Url: https://git.frykholm.com/butterbackup.git/blobdiff_plain/adb576dde16cbc3f6f0a61794a532a9487f63084..HEAD:/butterbackup.py diff --git a/butterbackup.py b/butterbackup.py index 99cf3c7..110077c 100755 --- a/butterbackup.py +++ b/butterbackup.py @@ -29,13 +29,20 @@ class Host(): return() command = ("rsync -a --acls --xattrs --whole-file --numeric-ids --delete --delete-excluded --human-readable --inplace ") - excludes = " --exclude " + " --exclude ".join(self.config.get("host", "exclude").split(',')) #FIXME + if self.config.has_option("host", "include"): + includes = " --include " + " --include ".join(self.config.get("host", "include").split(',')) #FIXME + command = command + includes + if self.config.has_option("host", "exclude"): + excludes = " --exclude " + " --exclude ".join(self.config.get("host", "exclude").split(',')) #FIXME + command = command + excludes try: - print(command + excludes + " root@%s:/ "%(self.name) + self.subvol_dir) - check_call(shlex.split(command + excludes + " root@%s:/ "%(self.name) + self.subvol_dir)) + print(command + " root@%s:/ "%(self.name) + self.subvol_dir) + check_call(shlex.split(command + " root@%s:/ "%(self.name) + self.subvol_dir)) except CalledProcessError as ex: - if ex.returncode not in (12, 30): - print("Rsync did not transfer anything from %s, skipping snapshot."%self.name) + if ex.returncode in (24,): + pass + else: + print("Rsync error from %s, skipping snapshot. Rsync exit value=%s"%(self.name, ex.returncode)) return() todays_date = datetime.datetime.now().date().strftime("%F") if os.path.exists(os.path.join(self.host_dir, todays_date)):