pvl/backup/rsync.py
changeset 51 9525d3e150ec
parent 50 d23cba8064fe
child 57 52a4be76e85a
equal deleted inserted replaced
50:d23cba8064fe 51:9525d3e150ec
   245     """
   245     """
   246         Figure out source to rsync from, based on pseudo-path given in rsync command.
   246         Figure out source to rsync from, based on pseudo-path given in rsync command.
   247 
   247 
   248             lvm_opts        - dict of **opts for RSyncLVMServer
   248             lvm_opts        - dict of **opts for RSyncLVMServer
   249     """
   249     """
       
   250 
       
   251     endslash = path.endswith('/')
   250         
   252         
   251     # normalize
   253     # normalize
   252     path = os.path.normpath(path)
   254     path = os.path.normpath(path)
       
   255 
       
   256     if endslash and not path.endswith('/') :
       
   257         # add it back in
       
   258         # happens for 'foo:/' and such
       
   259         path += '/'
   253 
   260 
   254     # verify path
   261     # verify path
   255     if restrict_path :
   262     if restrict_path :
   256         if not path.startswith(restrict_path) :
   263         if not path.startswith(restrict_path) :
   257             raise RSyncCommandFormatError("Restricted path ({restrict})".format(restrict=restrict_path))
   264             raise RSyncCommandFormatError("Restricted path ({restrict})".format(restrict=restrict_path))