Skip to content

Commit

Permalink
Merge pull request #279 from CPSSD/n/binary_management#265
Browse files Browse the repository at this point in the history
Create random dir for binaries
  • Loading branch information
iandioch authored Apr 20, 2017
2 parents 3683612 + 5493256 commit c2c3f33
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion dipla/client/client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
from dipla.shared.statistics import StatisticsUpdater
from logging import FileHandler
import multiprocessing
import hashlib
import string
import random
import os


class ClientFactory:
Expand Down Expand Up @@ -89,4 +93,13 @@ def _create_verify_inputs_service(client):

@staticmethod
def _create_binary_receiver(client):
return BinaryReceiverService(client, './binary')
m = hashlib.md5()
path = None
while True:
m.update(random.choice(string.ascii_letters).encode('utf-8'))
path = '.dipla_' + m.hexdigest()
if not os.path.isdir(path):
os.mkdir(path)
break
path += '/'
return BinaryReceiverService(client, path)

0 comments on commit c2c3f33

Please sign in to comment.