Unable to create files in workspace
Summary
Molecule requires the ability to create a cache directory (.cache) in the workspace dir (/opt/app-root/src) to operate properly. Currently, the user default
does not have ownership of the folder (despite having ownership of the parent folder). This causes molecule to fail as it cannot create a cache directory.
Steps to reproduce
run molecule test with any role or collection loaded into the image.
What is the current bug behavior?
molecule will error
File "/opt/app-root/lib/python3.6/site-packages/molecule/scenario.py", line 101, in __init__
self._setup()
File "/opt/app-root/lib/python3.6/site-packages/molecule/scenario.py", line 270, in _setup
if not os.path.isdir(self.inventory_directory):
File "/opt/app-root/lib/python3.6/site-packages/molecule/scenario.py", line 190, in inventory_directory
return os.path.join(self.ephemeral_directory, "inventory")
File "/opt/app-root/lib/python3.6/site-packages/molecule/scenario.py", line 166, in ephemeral_directory
path = ephemeral_directory(project_scenario_directory)
File "/opt/app-root/lib/python3.6/site-packages/molecule/scenario.py", line 290, in ephemeral_directory
Path(d).mkdir(mode=0o700, parents=True, exist_ok=True)
File "/usr/lib64/python3.6/pathlib.py", line 1252, in mkdir
self.parent.mkdir(parents=True, exist_ok=True)
File "/usr/lib64/python3.6/pathlib.py", line 1252, in mkdir
self.parent.mkdir(parents=True, exist_ok=True)
File "/usr/lib64/python3.6/pathlib.py", line 1252, in mkdir
self.parent.mkdir(parents=True, exist_ok=True)
File "/usr/lib64/python3.6/pathlib.py", line 1248, in mkdir
self._accessor.mkdir(self, mode)
File "/usr/lib64/python3.6/pathlib.py", line 387, in wrapped
return strfunc(str(pathobj), *args)
PermissionError: [Errno 13] Permission denied: '/opt/app-root/src/.cache'
What is the expected correct behavior?
molecule should be able to run create an ephemeral cache dir and manage it in /opt/app-root/src.
Relevant logs and/or screenshots
File "/opt/app-root/lib/python3.6/site-packages/molecule/scenario.py", line 101, in __init__
self._setup()
File "/opt/app-root/lib/python3.6/site-packages/molecule/scenario.py", line 270, in _setup
if not os.path.isdir(self.inventory_directory):
File "/opt/app-root/lib/python3.6/site-packages/molecule/scenario.py", line 190, in inventory_directory
return os.path.join(self.ephemeral_directory, "inventory")
File "/opt/app-root/lib/python3.6/site-packages/molecule/scenario.py", line 166, in ephemeral_directory
path = ephemeral_directory(project_scenario_directory)
File "/opt/app-root/lib/python3.6/site-packages/molecule/scenario.py", line 290, in ephemeral_directory
Path(d).mkdir(mode=0o700, parents=True, exist_ok=True)
File "/usr/lib64/python3.6/pathlib.py", line 1252, in mkdir
self.parent.mkdir(parents=True, exist_ok=True)
File "/usr/lib64/python3.6/pathlib.py", line 1252, in mkdir
self.parent.mkdir(parents=True, exist_ok=True)
File "/usr/lib64/python3.6/pathlib.py", line 1252, in mkdir
self.parent.mkdir(parents=True, exist_ok=True)
File "/usr/lib64/python3.6/pathlib.py", line 1248, in mkdir
self._accessor.mkdir(self, mode)
File "/usr/lib64/python3.6/pathlib.py", line 387, in wrapped
return strfunc(str(pathobj), *args)
PermissionError: [Errno 13] Permission denied: '/opt/app-root/src/.cache'
Possible fixes
the user (default) is given ownership of the /opt/app-root/src folder. It already has ownership of /opt/app-root and the fact that /src folder isn't included is likely an oversite.
Defintion of Done
-
Bug has been identified and corrected within the container
/cc @ironbank-notifications/bug