Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] direxec should not try to execute directories #508

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/direxec
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ except OSError:
# Run scripts
for executable, folder in sorted(files):
command = os.path.join(folder, executable)
if os.access(command, os.X_OK):
if os.access(command, os.X_OK) and not os.path.isdir(command):
logger.debug("Executing %s", command)
subprocess.check_call(command)

Expand Down
14 changes: 14 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,20 @@ def test_aggregate_permissions(self):
("autoaggregate",),
)

def test_entrypoint_python(self):
symlink_dir = join(SCAFFOLDINGS_DIR, "entrypoint")
for sub_env in matrix():
self.compose_test(
symlink_dir,
dict(sub_env, UID=str(os.getuid()), GID=str(os.getgid())),
# we verify that customizing entrypoint with python files work by writing to
# /tmp/customize_entrypoint.mark.txt with 60-customize_entrypoint.py
(
"cat",
"/tmp/customize_entrypoint.mark.txt",
),
)


if __name__ == "__main__":
unittest.main()
2 changes: 2 additions & 0 deletions tests/scaffoldings/entrypoint/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ARG ODOO_VERSION
FROM tecnativa/doodba:${ODOO_VERSION}-onbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import doodbalib

doodbalib.logger.info("custom entrypoint running")
with open("/tmp/customize_entrypoint.mark.txt", "w") as fp:
fp.write("ok\n")
doodbalib.logger.info("custom created /tmp/customize_entrypoint.mark.txt")
Empty file.
30 changes: 30 additions & 0 deletions tests/scaffoldings/entrypoint/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: "2.1"
services:
odoo:
build:
context: ./
args:
# compile causes the creation of __pycache__ in entrypoint.d for this test
COMPILE: "true"
ODOO_VERSION: $ODOO_MINOR
WITHOUT_DEMO: "false"
tty: true
depends_on:
- db
environment:
PYTHONOPTIMIZE: ""
UNACCENT: "false"
volumes:
- filestore:/var/lib/odoo:z

db:
image: postgres:${DB_VERSION}-alpine
environment:
POSTGRES_USER: odoo
POSTGRES_PASSWORD: odoopassword
volumes:
- db:/var/lib/postgresql/data:z

volumes:
db:
filestore: