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

Log messages from SaltDaemon in Docker container are missing #139

Open
rhansen opened this issue Oct 26, 2022 · 1 comment
Open

Log messages from SaltDaemon in Docker container are missing #139

rhansen opened this issue Oct 26, 2022 · 1 comment

Comments

@rhansen
Copy link

rhansen commented Oct 26, 2022

When running an integration test that uses saltfactories.daemons.container.SaltDaemon, the Python log messages emitted by the daemon do not show up in the test log. IIUC, this is because Python does not see the entry_points.txt for pytest-salt-factories so it doesn't know that it should load saltfactories.utils.saltext.log_handlers.pytest_log_handler.

One solution (that I tested successfully) is to pip install pytest-salt-factories when building the Docker image or after starting the Docker container. This assumes that pip is installed in the image, pip runs with sufficient privileges to install the package, and the version of pytest-salt-factories installed in the container is compatible with the version loaded by nox for the test.

Another solution (untested) might be to bind mount CODE_ROOT_DIR.parent instead of CODE_ROOT_DIR and add it to Python's sys.path when launching the daemon. This assumes that all of the packages in that directory are compatible with the container, which might be running a different version of Python (or even a different machine architecture).

Maybe another solution (untested) would be to bind mount CODE_ROOT_DIR.parent / "pytest_salt_factories-1.0.0rc20.dist-info" (where the specific .dist-info dir is discovered programmatically) in addition to CODE_ROOT_DIR, and add CODE_ROOT_DIR.parent to sys.path. This assumes that the pytest-salt-factories distribution is binary compatible with the container, which seems likely.

Perhaps the best solution would be to create a virtualenv inside the container and pip install all daemon dependencies plus pytest-salt-factories before starting the daemon.

Additional context: saltstack/salt#62791 (comment)

@s0undt3ch
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants