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 ansible#4142 - config file in proj dir (second attempt) #4373

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

erichoog
Copy link

This resolves the issue raised in Issue #4142 where Molecule does not find the config.yml file the project directory {project_dir}/.config/molecule/config.yml but does find it in the home directory.

I ran tests by isolating the 2 functions being called when LOCAL_CONFIG variable is defined and verifying that the config file is found when in the project dir. If there is no {project_dir}/.config/molecule/config.yml then it looks in ~/.config/molecule/config.yml and finds the config file.

I have not been able to test the full project with the tox command as my environment is having issues. The tox tests are not completing even on a freshly cloned repo.

The code in the find_vcs_root function could likely be modified more as it does not appear to be called elsewhere and it searches for ".git", ".hg", ".svn" dirs as well for what appears to be no reason as far as I can tell since it is only used for locating .config/molecule/config.yml

Let me know if anything can be improved upon here with my delivery of this as it is my first PR with the project.

Fixes: #4142

@erichoog erichoog requested a review from a team as a code owner January 22, 2025 03:06
@Qalthos Qalthos added the bug label Jan 22, 2025
@audgirka audgirka force-pushed the molecule-config-file branch from 7be3c21 to 9edc243 Compare January 27, 2025 17:25
Copy link
Member

@ssbarnea ssbarnea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing tests and documentation, the .config folder is not realy a vcs.

@erichoog
Copy link
Author

Missing tests and documentation, the .config folder is not realy a vcs.

I'll work on adding the tests hopefully this week.

For the .config not being a vcs, I'll take a look at the code again and see if this should be implemented elsewhere or in a new function.

@erichoog
Copy link
Author

Missing tests and documentation, the .config folder is not realy a vcs.

@ssbarnea After reviewing this further, I have determined that the issue I was seeing was because I was not using vcs like git in my test project dir. Therefore, since there was no .git directory in my project directory the find_vcs_root function was not finding my .config/molecule/config.yml file.

I am now wondering if it would just make more sense to update the documentation to make it more clear that the .config/molecule/config.yml would only be found in the project directory if version control is being used?

Or would it still be good to pursue modifying the code to allow the .config/molecule/config.yml to be found in the project dir when source control is not being used?

@Qalthos Qalthos self-requested a review January 29, 2025 13:00
@alisonlhart alisonlhart marked this pull request as draft February 5, 2025 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Molecule config file in {project}/.config/molecule/config.yml not found
3 participants