Australian-Imaging-Service / xnat4tests

A Python module that stands up a basic XNAT repository in a single Docker container to be used in testing pipelines interact with the XNAT API and/or container service
Other
5 stars 4 forks source link

Re-launching xnat4tests fails #7

Open jhuguetn opened 2 years ago

jhuguetn commented 2 years ago

Re-launching xnat4tests via CLI launcher leads to a permission error caused by an attempt to remove preexisting content created by XNAT as root user.

See error trace,

2022-11-07 10:47:46,995 - xnat4tests - INFO - Building xnat4tests in '/home/jhuguet/.xnat4tests/build' directory
2022-11-07 10:47:51,925 - xnat4tests - INFO - Built xnat4tests successfully
2022-11-07 10:47:51,926 - xnat4tests - INFO - Did not find xnat4tests container, relaunching
Traceback (most recent call last):
  File "/home/jhuguet/envs/xnat4tests/bin/xnat4tests_launch", line 8, in <module>
    sys.exit(launch_cli())
   ...
  File "/home/jhuguet/envs/xnat4tests/lib/python3.8/site-packages/xnat4tests/launch.py", line 94, in launch_xnat
    shutil.rmtree(config["xnat_root_dir"])
  File "/usr/lib/python3.8/shutil.py", line 718, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  PermissionError: [Errno 13] Permission denied: '%0044efault%0043atalog%0053ervice%0043ache.data'

Set of subfolders causing the error (owned by root),

/home/xxx/.xnat4tests/xnat_root/home/work
/home/xxx/.xnat4tests/xnat_root/home/logs
tclose commented 2 months ago

Hi @jhuguetn , just realised that I missed this (way back in 2022!). I believe I have fixed this now. It is due to docker running XNAT within docker as root and creating the files, which then can't be cleared.