added arguments for permissions of created dirs and files to deltatar.create_full...
authorChristian Herdtweck <christian.herdtweck@intra2net.com>
Wed, 6 Apr 2016 16:04:46 +0000 (18:04 +0200)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Wed, 6 Apr 2016 16:04:46 +0000 (18:04 +0200)
deltatar/deltatar.py

index ff8292a..9ae5fd2 100644 (file)
@@ -508,7 +508,8 @@ class DeltaTar(object):
                        key_length=key_length)
 
     def create_full_backup(self, source_path, backup_path,
-                           max_volume_size=None, extra_data=dict()):
+                           max_volume_size=None, extra_data=dict(),
+                           dir_perms=0o077, file_perms=0o066):
         '''
         Creates a full backup.
 
@@ -551,7 +552,7 @@ class DeltaTar(object):
 
         # try to create backup path if needed
         if not os.path.exists(backup_path):
-            os.makedirs(backup_path)
+            os.makedirs(backup_path, dir_perms)
 
         if not os.access(backup_path, os.W_OK):
             raise Exception('Backup path "%s" is not writeable' % backup_path)
@@ -654,7 +655,8 @@ class DeltaTar(object):
         tarobj.close()
 
     def create_diff_backup(self, source_path, backup_path, previous_index_path,
-                           max_volume_size=None, extra_data=dict()):
+                           max_volume_size=None, extra_data=dict(),
+                           dir_perms=0o077, file_perms=0o066):
         '''
         Creates a backup.
 
@@ -710,7 +712,7 @@ class DeltaTar(object):
 
         # try to create backup path if needed
         if not os.path.exists(backup_path):
-            os.makedirs(backup_path)
+            os.makedirs(backup_path, dir_perms)
 
         if not os.access(backup_path, os.W_OK):
             raise Exception('Backup path "%s" is not writeable' % backup_path)