[PR #7369/1bf5a44a backport][stable-6] Fix lxc plugin options #7370
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.
This is a backport of PR #7369 as merged into main (1bf5a44).
SUMMARY
Because the lxc plugin was only using
PlayContext
properties, using host vars likeansible_lxc_host
didn't work. This is fixed by instead using theget_option
method inherited fromAnsiblePlugin
. The options are not yet available in the__init__
function, so the determination of the container name is moved to the_connect
method, which is the first time it is actually needed. The default for theremote_addr
option is removed, because the stringinventory_hostname
is not very useful. At all. This seams to have been spread with copy&paste and a bit of cargo culting. The variable priority already takes care of setting the value.Add a fixture to allow testing the lxc connection plugin both with and without liblxc being present. Also change the test from unittest to pytest, and add more tests.
ISSUE TYPE
COMPONENT NAME
lxc
ADDITIONAL INFORMATION