I am working on setting up a project with Molecule and saw in the documentation that we can put configurations into {PROJECT_DIR}/.config/molecule/config.yml or into ~/.config/molecule/config.yml So I was doing a few tests to learn more.
I am having an issue where if I put settings into {PROJECT_DIR}/.config/molecule/config.yml they are not read but they are read if I move that directory to my user home directory.
Version Information:
>molecule --version
molecule 6.0.3 using python 3.11
ansible:2.16.2
azure:23.5.0 from molecule_plugins
containers:23.5.0 from molecule_plugins requiring collections: ansible.posix>=1.3.0 community.docker>=1.9.1 containers.podman>=1.8.1
default:6.0.3 from molecule
docker:23.5.0 from molecule_plugins requiring collections: community.docker>=3.0.2 ansible.posix>=1.4.0
ec2:23.5.0 from molecule_plugins
gce:23.5.0 from molecule_plugins requiring collections: google.cloud>=1.0.2 community.crypto>=1.8.0
podman:23.5.0 from molecule_plugins requiring collections: containers.podman>=1.7.0 ansible.posix>=1.3.0
vagrant:23.5.0 from molecule_plugins
Hereβs what I see if I configure using ~/.config/molecule/config.yml - it finds the file and the settings are used:
$ molecule converge
INFO Found config file /home/my_user/.config/molecule/config.yml
But when I remove that config in the home dir and leave it in my project root dir it does not read these settings. I tried moving the .config directory to all different levels within the project dir with no luck.
Am I doing something wrong or is this an issue in Molecule or the documentation?
Please note Iβm not a python dev so I may be misunderstanding the code but I took a look at the source code and if I am reading it correctly I think I see the issue :
The find_vcs_root() function has some arguments with default values: location="" and default=None
The function then has logic to set location to the current working dir if location=""
It does some other logic and then returns the value of default variable.
It does not seem to me like the default variable ever gets updated in this function.
When find_vcs_root() is called by lookup_config_file() itβs getting default="~" passed to it.
It almost looks to me like find_vcs_root() will always only check the user home directory for .config/molecule/config.yml
Again I could be reading this completely wrong! If I am please let me know and if am right then let me know if I should raise an issue for this in the GitHub repo.