doodba icon indicating copy to clipboard operation
doodba copied to clipboard

entrypoint.d python scripts do not work for prod.yaml/compile

Open ap-wtioit opened this issue 2 years ago • 1 comments

Describe the bug

When adding a python script to a doodba-... project in entrypoint.d one cannot use compile=true

Creating entrypoint_odoo_run ... done
doodba INFO: Waiting until postgres is listening at db...
doodba INFO: Linking all addons from /opt/odoo/custom/src/addons.yaml in /opt/odoo/auto/addons
doodba INFO: Generating /opt/odoo/auto/odoo.conf file. Overriding any existing...
doodba INFO: Merging found configuration files in /opt/odoo/auto/odoo.conf
Traceback (most recent call last):
  File "/opt/odoo/common/entrypoint", line 30, in <module>
    subprocess.check_call(command)
  File "/usr/local/lib/python3.8/subprocess.py", line 359, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/usr/local/lib/python3.8/subprocess.py", line 340, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/local/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/local/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: '/opt/odoo/custom/entrypoint.d/__pycache__'
INFO:root:Subtest execution: test_entrypoint_python (tests.ScaffoldingCase) (PWD='/home/runner/work/doodba/doodba/tests/scaffoldings/entrypoint', ODOO_MINOR='14.0', DB_VERSION='14', UID='1001', GID='121')

edit: Updated with error in github actions (to make it clear it's not my custom setup)

To Reproduce

Affected versions:

Steps to reproduce the behavior:

  1. run tests in https://github.com/Tecnativa/doodba/pull/508

Expected behavior

python scripts in entrypoint.d should work with compile=true

Additional context Add any other context about the problem here. (e.g. OS, Docker version, ...)

I'm working on a fix for this in https://github.com/Tecnativa/doodba/pull/508

Info @wt-io-it

ap-wtioit avatar Jul 04 '22 09:07 ap-wtioit

Bug exists since f931b534872fed96e9037ad31eb5b90ada4b3111, where the bash script direxec.sh was incorrectly converted to python direxec:

  • run-parts --exit-on-error does not try to execute sub directories even if they have x permissions (for traversing into the directory)
  • os.access(command, os.X_OK) returns true for directories with permission x

ap-wtioit avatar Jul 04 '22 11:07 ap-wtioit