Repository navigation
Added state-file driver validation - #3429
Conversation
|
@superstes Is my impression or this should fix #2540 ? |
| driver_from_cli = self.command_args.get("driver_name") | ||
|
|
||
| if driver_from_state_file: | ||
| if driver_from_state_file and driver_from_state_file in api.drivers(): |
There was a problem hiding this comment.
maybe I'm seeing problems where there are none because I've not understood what it's doing... I'm wondering if the check is enough. For instance, the scenario is configured to use driver "foo", the user installs driver "bar" and modify the configuration to use driver "bar" but doesn't uninstall the driver "foo", will the driver change get noticed ?
There was a problem hiding this comment.
I think those are two different problems. "We are missing a driver that initialized scenario is using" is one and the other is "Scenario and its initialized instance diverged."
Current PR is trying to solve the first issue (making sure we can still converge, etc., against an initialized scenario) and does not tackle the second issue.
I am not sure if it is even possible to solve the second problem without making some severe changes to Molecule's internals. Why? It seems to me that once we initialize the scenario, Molecule should ignore changes to the source configuration and always use configuration from the initialized instance. But currently, Molecule does not distinguish this and always uses source config as a fallback configuration.
|
This issue is related to #2540, yes. I completely agree with you that the user should at least get a warning when the cache might be 'invalid'. I'll give my input if I've found a good way of solving this.
So true. I only found it after looking into the code. |
Moved validation of driver pulled from state-file to the end of 'get_driver_name' to throw an error.
|
@superstes If you find the approval annoying please find a very simple fix, like a typo and propose it. This approval appears only for those that never contributed and cannot be disabled. |
|
@superstes Any chance to revive this? |
|
@ssbarnea Sorry for the delay - updated the test. |
It seems the driver pulled from existing state-file(s) was not yet validated against the available drivers.
This was problematic for me as I previously used 'vagrant' and changed it to use 'docker'.
That simple check (as already used in the molecule.yml schema-validation) should fix this behaviour.
I pulled my hair out yesterday trying to understand why the configured 'docker' driver was not used by molecule.
There was no transparent way to know why molecule did not use my configuration. (as an user)