Fix connection plugin name setting #3957
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In ansible_connection_options(), when setting connection plugin name, the code does:
Looking at instance_params, for the connection, there's a default value neither None nor False, leading to the the being true and setting ansible_connection to d.get(i[0]), which may not be defined. In this case, this will lead to ansible_connection being set to None. This will lead to troubles. For instance, when using 'meta: reset_connection', ansible in _execute_meta() will call plugin_loader.connection_loader.get() with first param being None, leading to :
ERROR! Unexpected Exception, this is probably a bug: 'NoneType' object has no attribute 'startswith'
So, ensure that the default value is set when setting conn_dict.
Fixes: 5b750ff ("Adds Support for Shell Type Instance Param to Delegated Driver")