pvl.backup.rsync: preserve trailing / in source path
authorTero Marttila <terom@paivola.fi>
Sun, 22 Apr 2012 13:59:51 +0300
changeset 51 9525d3e150ec
parent 50 d23cba8064fe
child 52 0c8413b35dd3
pvl.backup.rsync: preserve trailing / in source path
pvl/backup/rsync.py
rsync-snapshot.conf
--- a/pvl/backup/rsync.py	Sun Apr 22 13:49:54 2012 +0300
+++ b/pvl/backup/rsync.py	Sun Apr 22 13:59:51 2012 +0300
@@ -247,10 +247,17 @@
 
             lvm_opts        - dict of **opts for RSyncLVMServer
     """
+
+    endslash = path.endswith('/')
         
     # normalize
     path = os.path.normpath(path)
 
+    if endslash and not path.endswith('/') :
+        # add it back in
+        # happens for 'foo:/' and such
+        path += '/'
+
     # verify path
     if restrict_path :
         if not path.startswith(restrict_path) :
--- a/rsync-snapshot.conf	Sun Apr 22 13:49:54 2012 +0300
+++ b/rsync-snapshot.conf	Sun Apr 22 13:59:51 2012 +0300
@@ -27,7 +27,7 @@
 format  = %Y
 
 ## Targets
-# test
+# fs
 [targets/test]
 path    = ./test
 source  = /srv/lvm-test/
@@ -40,11 +40,18 @@
 [targets/test/rsync_options]
 exclude-from    = ignore.list
 
+# remote
+[targets/test2]
+path    = ./test
+source  = localhost:/
 
-# test-lvm
+[targets/test2/intervals]
+recent  = 4
+
+# local lvm
 [targets/test-lvm]
 path    = ./test-lvm
-source  = lvm:asdf:test
+source  = lvm:asdf/test
 
 [targets/test-lvm/intervals]
 recent  = 4
@@ -53,6 +60,14 @@
 wait    = 1
 size    = 1G
 
+# remote lvm
+# [targets/test-lvm2]
+# path  = ./test-lvm
+# source = localhost:lvm:asdf/test
+# 
+#[targets/test-lvm2/intervals]
+#recent  = 4
+
 
 
 ## Runs