Commit 097e496b authored by Mark Hymers's avatar Mark Hymers Committed by Joe Lyons
Browse files

Fix up permissions


Signed-off-by: Mark Hymers's avatarMark Hymers <mark.hymers@ynic.york.ac.uk>
parent f4e84472
......@@ -365,11 +365,11 @@ class IncomingProcessor(object):
# Copy final versions of the files into the right place
try:
logging.info("Anonymous copies going to %s" % anondname)
makedirs_chmod(anondname, mode=studydest.mode_anon_dir)
makedirs_chmod(anondname, mode=studydest.mode_anon_dir, exist_ok=True)
if study.raw_file is not None:
makedirs_chmod(join(anondname, 'raw'), mode=studydest.mode_anon_dir)
makedirs_chmod(join(anondname, 'raw'), mode=studydest.mode_anon_dir, exist_ok=True)
if study.proc_file is not None:
makedirs_chmod(join(anondname, 'processed'), mode=studydest.mode_anon_dir)
makedirs_chmod(join(anondname, 'processed'), mode=studydest.mode_anon_dir, exist_ok=True)
except OSError as e:
if e.errno == EEXIST:
logging.info("Could not make directories %s" % anondname)
......@@ -377,12 +377,14 @@ class IncomingProcessor(object):
raise(e)
if study.raw_file is not None:
tgt_dir = join(anondname, 'raw')
copy2(tmp_raw_path, join(tgt_dir, filebname))
tgt_name = join(anondname, 'raw', filebname)
copy2(tmp_raw_path, tgt_name)
chmod(tgt_name, studydest.mode_anon_file)
if study.proc_file is not None:
tgt_dir = join(anondname, 'processed')
copy2(tmp_proc_path, join(tgt_dir, filebname))
tgt_name = join(anondname, 'processed', filebname)
copy2(tmp_proc_path, tgt_name)
chmod(tgt_name, studydest.mode_anon_file)
if self.remove_incoming_after:
# Unlink the raw and processed original files
......@@ -395,4 +397,6 @@ class IncomingProcessor(object):
except OSError as e:
logging.error("Error removing files from incoming ({})".format(e))
logging.info("Completed processing MEG Study: {}".format(study.base_filename))
__all__.append('IncomingProcessor')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment