1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/tests/unit
patchback[bot] 02a257569a
[PR #7369/1bf5a44a backport][stable-6] Fix lxc plugin options (#7370)
Fix lxc plugin options (#7369)

* Fixture for liblxc

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.

* Update liblxc error message

The error is not specific to python2, so remove the version. Also add
a test for it.

* Migrate to options

Because the lxc plugin was only using PlayContext properties, using host
vars like `ansible_lxc_host` didn't work. This is fixed by instead using
the `get_option` method inherited from `AnsiblePlugin`.
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 the `remote_addr` option is removed, because the string
`inventory_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 changelog fragment

* Fix for Py2.7

`TypeError: super() takes at least 1 argument (0 given)`

* Add plugin type to changelog fragment.

* Restore untemplated default

This partially reverts commit 429d8c8cfb.

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 1bf5a44a77)

Co-authored-by: Corubba <97832352+corubba@users.noreply.github.com>
2023-10-09 09:21:43 +02:00
..
compat [PR #5978/9f87989e backport][stable-6] Remove unnecessary test imports (#5979) 2023-02-12 21:36:32 +01:00
mock [stable-6] Avoid direct type comparisons (#7087) 2023-08-11 13:39:42 +02:00
plugins [PR #7369/1bf5a44a backport][stable-6] Fix lxc plugin options (#7370) 2023-10-09 09:21:43 +02:00
requirements.txt [PR #6980/796ad356 backport][stable-6] [proxmox] Use proxmoxer_version instead of server API version (#6984) 2023-07-20 20:51:53 +02:00
requirements.yml [PR #6549/d643bd57 backport][stable-6] Switch to Ansible Galaxy compatible requirements files for tests (#6551) 2023-05-21 15:09:20 +02:00