EOF & whitespace
This commit is contained in:
@@ -30,7 +30,7 @@ from libtisbackup.common import *
|
||||
|
||||
class backup_rsync(backup_generic):
|
||||
"""Backup a directory on remote server with rsync and rsync protocol (requires running remote rsync daemon)"""
|
||||
type = 'rsync'
|
||||
type = 'rsync'
|
||||
required_params = backup_generic.required_params + ['remote_user','remote_dir','rsync_module','password_file']
|
||||
optional_params = backup_generic.optional_params + ['compressionlevel','compression','bwlimit','exclude_list','protect_args','overload_args']
|
||||
|
||||
@@ -46,7 +46,7 @@ class backup_rsync(backup_generic):
|
||||
overload_args = None
|
||||
compressionlevel = 0
|
||||
|
||||
|
||||
|
||||
|
||||
def read_config(self,iniconf):
|
||||
assert(isinstance(iniconf,ConfigParser))
|
||||
@@ -54,7 +54,7 @@ class backup_rsync(backup_generic):
|
||||
if not self.bwlimit and iniconf.has_option('global','bw_limit'):
|
||||
self.bwlimit = iniconf.getint('global','bw_limit')
|
||||
if not self.compressionlevel and iniconf.has_option('global','compression_level'):
|
||||
self.compressionlevel = iniconf.getint('global','compression_level')
|
||||
self.compressionlevel = iniconf.getint('global','compression_level')
|
||||
|
||||
def do_backup(self,stats):
|
||||
if not self.set_lock():
|
||||
@@ -216,7 +216,7 @@ class backup_rsync(backup_generic):
|
||||
raise
|
||||
|
||||
|
||||
finally:
|
||||
finally:
|
||||
self.remove_lock()
|
||||
|
||||
def get_latest_backup(self,current):
|
||||
@@ -225,8 +225,8 @@ class backup_rsync(backup_generic):
|
||||
filelist.sort()
|
||||
filelist.reverse()
|
||||
full = ''
|
||||
r_full = re.compile('^\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}$')
|
||||
r_partial = re.compile('^\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}.rsync$')
|
||||
r_full = re.compile('^\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}$')
|
||||
r_partial = re.compile('^\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}.rsync$')
|
||||
# we take all latest partials younger than the latest full and the latest full
|
||||
for item in filelist:
|
||||
if r_partial.match(item) and item<current:
|
||||
@@ -245,7 +245,7 @@ class backup_rsync(backup_generic):
|
||||
|
||||
filelist = os.listdir(self.backup_dir)
|
||||
filelist.sort()
|
||||
p = re.compile('^\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}$')
|
||||
p = re.compile('^\d{8,8}-\d{2,2}h\d{2,2}m\d{2,2}$')
|
||||
for item in filelist:
|
||||
if p.match(item):
|
||||
dir_name = os.path.join(self.backup_dir,item)
|
||||
@@ -288,7 +288,7 @@ class backup_rsync(backup_generic):
|
||||
return False
|
||||
else:
|
||||
self.logger.info("[" + self.backup_name + "] incorrrect lock file : no pid line")
|
||||
return False
|
||||
return False
|
||||
|
||||
|
||||
def set_lock(self):
|
||||
@@ -317,7 +317,7 @@ class backup_rsync(backup_generic):
|
||||
|
||||
class backup_rsync_ssh(backup_rsync):
|
||||
"""Backup a directory on remote server with rsync and ssh protocol (requires rsync software on remote host)"""
|
||||
type = 'rsync+ssh'
|
||||
type = 'rsync+ssh'
|
||||
required_params = backup_generic.required_params + ['remote_user','remote_dir','private_key']
|
||||
optional_params = backup_generic.optional_params + ['compression','bwlimit','ssh_port','exclude_list','protect_args','overload_args', 'cipher_spec']
|
||||
cipher_spec = ''
|
||||
@@ -341,4 +341,3 @@ if __name__=='__main__':
|
||||
b.read_config(cp)
|
||||
b.process_backup()
|
||||
print((b.checknagios()))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user