Mike Bayer avatar Mike Bayer committed 3766276

add a token

Comments (0)

Files changed (1)

backups/synthetic.py

 from multiprocessing import Pool
 import tempfile
 import shutil
+import uuid
 
+s3 = None
 def duplicity_cmd(cmd_options, replace_dict, *args):
 
     cmd_options = list(cmd_options)
     base._run_duplicity(None, cmd_options, False, False)
 
 def log(msg, *args):
-    print msg % args
+    print(msg % args)
 
 def _copy_key(arg):
     source_name, keyname, dest_name = arg
     source_bucket_name = re.match(r"s3\+http:\/\/(.+)",
                                         target_url).group(1)
 
-    tmp_source = "tmp_source_%s" % source_bucket_name
-    tmp_dest = "tmp_dest_%s" % source_bucket_name
+    token = uuid.uuid4().hex[0:12]
+    tmp_source = "tmp_source_%s_%s" % (token, source_bucket_name)
+    tmp_dest = "tmp_dest_%s_%s" % (token, source_bucket_name)
 
     replace_dict = {"source_bucket_name": source_bucket_name,
                     "tmp_source": tmp_source,
         run_duplicity_cmd = functools.partial(
                                 duplicity_cmd, cmd_options, replace_dict)
 
-        
+
         source_bucket = s3.lookup(source_bucket_name)
 
         all_source_keys = set(k.key for k in source_bucket.list())
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.