1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
Commit graph

654 commits

Author SHA1 Message Date
Ross Williams
a52f4bb4a4 pkgng: Ansible 2.9 has no "false" Jinja2 test
Apparently Ansible 2.9 doesn't have the "false" test
in Jinja2 contexts. Switching to use `rejectattr(...)`
instead of `selectattr(..., "false")`.
2021-10-13 12:23:46 +00:00
Ross Williams
10a4f5ffcc pkgng: convert generator to list for 2.9
Ansible 2.9 can't count items from a generator,
so convert `select` filter output via `list`
before passing to `count`.
2021-10-13 11:14:11 +00:00
Ross Williams
b34aa1326e pkgng: make integration test package more flexible
Make integration test package building template-based,
so more flexible if in the future the name of the test package,
currently `zsh`, must change.
2021-10-13 02:24:45 +00:00
Ross Williams
32ce141397 pkgng: add test prepare task
Make sure test environment does not contain the
test package.
2021-10-13 02:24:45 +00:00
Ross Williams
4c5239e82f pkgng: fix check_mode for annotate
Actions specified in the `annotate` parameter would
always be performed, even if `check_mode=yes`.

This commit fixes `check_mode` for the annotation
functions and adds integration tests to ensure that
check mode is honored in the future.
2021-10-12 18:37:39 +00:00
Ross Williams
8f013549fd pkgng: test invalid annotate strings
Ensure that some likely to occur, invalid strings
given to the annotate module parameter 1. fail,
2. do not cause an exception, and 3. do not create
any actual annotations on packages.
2021-10-12 18:33:05 +00:00
Ross Williams
b872b294fd pkgng: test multiple annotations
Test multiple annotations specified both in new (YAML list)
syntax and old (comma-delimited) syntax.

Rename some annotation test tags from the single-annotation
tests to make sure that single and multiple annotation tests
don't collide.
2021-10-12 18:09:33 +00:00
Ross Williams
8453c368c1 pkgng: test annotation for single package
Add/modify/remove annotation for a single package
2021-10-12 15:03:25 +00:00
Ross Williams
6c5f9810b0 pkgng: pass tests when package dependencies change
Tests that install packages with dependencies were failing
when those dependencies were not already installed, because
the count of installed packages was greater than the count
of requested to be installed packages. This change checks
for a count of installed packages that is greater than or
equal to the count of requested to be installed packages.

Example:
  - Test installs packages `zsh` and `fish`
  - `fish` has a dependency on `pcre2`
  - `pkg` reports `Number of packages to be installed: 3`
2021-10-12 13:43:05 +00:00
Ross Williams
406683383e pkgng: test jail creation logging less verbose
`ezjail-admin` had been spewing every filename copied
into the jail onto stderr, making the `ansible-test -v`
logs hard to scroll through. Changed it so that ezjail
output only shows up in the ansible task logs if
`ansible_verbosity > 1` (`-vv...`). Full `ezjail-admin`
output is always logged to `/tmp/ezjail.log`.
2021-10-12 12:57:53 +00:00
Ross Williams
a803240941 pkgng: test autoremove=yes only on FreeBSD > 12
The CI test runner on FreeBSD 12.0 times out when
downloading large packages.
2021-10-12 01:52:30 +00:00
Ross Williams
4f18ef5ba6 pkgng: add test for autoremove=yes
Install package with known dependencies, then
remove it and ask autoremove to run.
2021-10-11 19:55:28 +00:00
Ross Williams
aa88d68ebc pkgng: use YAML lists for multiple packages
I had been following the documentation examples, and
specifiying multiple packages on one line. The right way
to do it is with YAML list syntax.
2021-10-11 19:28:26 +00:00
Ross Williams
98ccc58ba0 pkgng: test state=latest for mixed install/upgrade
Test that a list of packages given, one not installed
and one installed but out-of-date are handled correctly.
2021-10-11 19:25:06 +00:00
Ross Williams
73eafc126f pkgng: test install multiple packages
Multiple packages should install with a single
invocation of the `pkg` utility.
2021-10-11 18:14:38 +00:00
Ross Williams
8805f408d6 pkgng: refactor tests for task reuse
Several tests need to install an out-of-date package
to test whether upgrades occur successfully, so this
commit refactors out the generation of the test package.

Also, factor out things like the name and path of the
test package so that is more maintainable should the
target test package (currently `zsh`) ever need to
change.
2021-10-11 17:10:35 +00:00
Ross Williams
d075c83ff2 pkgng: move FreeBSD tasks to imported file
Refactoring tests for more reuse and easier
readability.
2021-10-11 16:24:08 +00:00
Ross Williams
5b13caa2d3 pkgng: test pkg works on any FreeBSD version
Removing `ansible_distribution_version`, because the
test out-of-date zsh package should install on any
FreeBSD version.
2021-10-11 16:03:25 +00:00
Ross Williams
c38eeeda0a pkgng: add cached=yes test
Changed idempotency test, because this covers both.
2021-10-11 12:49:47 +00:00
Ross Williams
752817cf5a pkgng: refactor renaming test package manifests
refactored to make intent of adding '+' sign clearer
2021-10-11 02:11:26 +00:00
Ross Williams
0eb4c8221c pkgng: CI seems to dislike plus-signs in filenames 2021-10-11 02:11:26 +00:00
Ross Williams
68a1332a3f pkgng: use hand-generated test package
Instead of relying on a broken-ish installation
of an older package from FreeBSD 11, hand-generate
a package named `zsh` with no contents and a version
number of `0`. It can be installed on any architecture
and any revision of FreeBSD sucessfully, and it will
always be eligible for upgrade.
2021-10-11 02:11:26 +00:00
Ross Williams
7f30ac8a5b pkgng: add state=latest test
Including small filesize out-of-date package from
FreeBSD 11 package repository, because FreeBSD 11 is
currently EOL. This test might fail at some point in the
future if the pkg utility in a FreeBSD version > 14
makes breaking changes that prevents it from installing
older package formats.

If that occurs, the fix is to replace
`files/freebsd-release-manifests-20210413__FreeBSD_11.pkg`
with the version of freebsd-release-manifests from the oldest
non-breaking release of FreeBSD, and update the
references to it in tasks/main.yml accordingly.
2021-10-11 02:11:26 +00:00
Ross Williams
1654a70825 pkgng: add state=latest idemptency test
Add test between state=present and
state=absent that ensures state=latest runs
successfully on an already up-to-date package
with changed=false.
2021-10-11 02:11:26 +00:00
Ross Williams
9a867a38ee pkgng: add state=absent test
Also renumber `jail=...` test to make diffs less
noisy when adding more non-jailed tests.
2021-10-11 02:11:26 +00:00
Ross Williams
840cb8f408 pkgng: remove redundant test for docker container
These tests should be skip/docker, but the test
playbook also redundantly checked whether it was
running in a docker container.

Checking whether `ansible_facts.distribution` is
`FreeBSD` is really sufficient to be sure whether
the test is running in an environment that supports
the `pkgng` module.
2021-10-11 02:11:26 +00:00
Ross Williams
867b7d5bee pkgng: test with zsh not bash package
Had been using bash package, because it's not
likely to disappear from the package repository
any time soon. Turns out that bash is already
installed on the Ansible community.general
FreeBSD CI VM image, which makes the test fail.

Zsh probably isn't going away any time soon,
either, and likely won't be installed on the
CI image.
2021-10-11 02:11:26 +00:00
Ross Williams
bfdaed0ce5 pkgng: add basic integration tests
Test installing a package
Test installing a package into a jail
2021-10-11 02:11:26 +00:00
Felix Fontein
d1f820ed06
Fix shellcheck error. (#3531) 2021-10-08 15:09:47 +02:00
Dominik Wombacher
f0fcb221cd
zypper_repository: Improve .repo file idempotency (#3474)
* If repo option points to .repo file, download for later parsing

* Parse downloaded .repo file content (ini format)

* Validate downloaded file, map values to repodata, workaround to ignore old .repo related code

* Integration Test adjusted to install python package 'requests' first

* Revert "Integration Test adjusted to install python package 'requests' first"

This reverts commit 0d18352c2238d098831ba6d59b66e731fa8f0cd9.
Not allowed to introduce new dependencies at this point, module_utils usage required

* Remove python 'requests' dependency, using 'fetch_url' and 'to_text' from 'ansible.module_utils' instead

* Prefer alias (name) if given instead repo (url)

* If gpgkey was given in .repo file ensure key get automatically imported

* ConfigParser Import made Python2 compatible

* New .repo code moved below existing run-time parameters checks to keep previous logic

* Obsolete workaround removed

* two pylint/pep8 errors fixed

* name added to autorefresh assert

* Missing assert for 'Delete test repo' added

* name added to priority option assert

* name added to check repo is updated by url assert

* name added to check repo is updated by name assert

* name added to check add a repo by releasever assert

* name added to check remove added repo assert

* name added to check add a repo by basearch assert

* name added to check remove added repo #2 assert

* Bugfix to avoid 'KeyError' Exception in if statements

* Refactoring of configparser related code, usage of module_utils, py2 compatibility

* Removal of some leftover from earlier testing

* Integration tests for add/remove repositories by url to .repo file added

* Additional name added to list of test repos that has to be removed

* Test added to verify cleanup of local .repo file after removal via zypper

* Changelog fragment related to PR #3474 added

* yamllint error resolved

* Refactoring to reduce indentation and removal of else statements

* Integration tests added for loading .repo file from local path

* Test .repo file added

* Dependency to setup_remote_tmp_dir added

* New entry added to 'remove repositories added during test'

* Support for .repo file from local path

* Changelog: Ref to https://github.com/ansible-collections/community.general/issues/3466 added

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
2021-10-08 07:40:30 +02:00
Greg
80bb42325b
[ufw] Insert or delete biased when deletion enabled - as for append or delete. (#3514)
* [ufw] Insert or delete biased when deletion enabled - as for append or delete.

* [ufw] Insert or delete biased when deletion enabled - as for append or delete.

* [ufw] Insert or delete biased when deletion enabled - as for append or delete.

* [ufw] Insert or delete biased when deletion enabled - as for append or delete.

* [ufw] Insert or delete biased when deletion enabled - as for append or delete.

* [ufw] Insert or delete biased when deletion enabled - as for append or delete.

* [ufw] Insert or delete biased when deletion enabled - as for append or delete.

* [ufw] Insert or delete biased when deletion enabled - as for append or delete.
2021-10-07 15:31:38 +02:00
Victor Martinez
e22fff2b12
[opentelemetry][callback] enrich stacktrace errors (#3496)
* [opentelemetry][callback] refactor get_error_message and add UTs

* [opentelemetry][callback] enrich exception with msg, exception and stderr fields

* [opentelemetry] fix linting

* [opentelemetry][callback] add changelog fragment

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Ajpantuso <ajpantuso@gmail.com>

* [opentelemetry][callback] chore: remove comment

* [opentelemetry][callback] refactor tests

* [opentelemetry] refactor UTs

Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Ajpantuso <ajpantuso@gmail.com>
2021-10-07 06:59:03 +02:00
Alexei Znamensky
f1807d3323
pipx - new module (#3507)
* pipx - new module

* using python instead of python3

* removed ensure_path as it is unused

* ensuring we are running the same python as Ansible

* changed the last solution to adding a pipx_path parameter to the module, with a sensible default

* added docs for the new parameter

* changed param name to executable, and customized it for Darwin

* use executable if passed, otherwise use python -m pipx

* minor update

* added examples

* Update plugins/modules/packaging/language/pipx.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/packaging/language/pipx.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/packaging/language/pipx.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* tests names 324 -> 3.24.0

* ensure tox is uninstalled by the beginning of the test

* Renamed option+suggestions from PR

* improved idempotency

* fixed sanity

* fixed test

Co-authored-by: Felix Fontein <felix@fontein.de>
2021-10-06 07:01:54 +02:00
Andreas Botzner
e95f63b067
Proxmox tasks module (#3226)
* Started creating Unit tests for Proxmox Tasks module

* Tried really hard to get the mock to work

* unit tests  for the module

* Fixed symslink and permissions

* Suggested changes and more unit tests

* Fixed isFalse

* Apply suggestions from code review

* Update plugins/modules/cloud/misc/proxmox_tasks_info.py

Co-authored-by: Felix Fontein <felix@fontein.de>
2021-10-03 22:21:33 +02:00
Felix Fontein
106856ed86
Fix OSX 10.11 CI runs (#3501)
* Restrict to OSX 10.11 tests.

* See whether updating brew helps.

* Skip archive task for OSX.

* Refactor homebrew task to make changing the package name easier.

* Revert "See whether updating brew helps."

This reverts commit 8eceb9ef1f.

* Replace xz by gnu-tar.

* Uninstall first.

* Skip iso_extract task for OSX.

* Revert "Restrict to OSX 10.11 tests."

This reverts commit 81823d2f97.

* ci_complete
2021-10-02 21:18:03 +02:00
Felix Fontein
5895e50185
yaml callback: prevent plugin from modifying PyYAML (#3478)
* Prevent yaml callback from modifying PyYAML.

* Fix changelog fragment.

* Update changelogs/fragments/3478-yaml-callback.yml

Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com>

Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com>
2021-10-01 22:42:39 +02:00
Felix Fontein
3fee872d58
Stick to community.crypto 1.x.y for ubuntu1604. (#3470) 2021-09-29 19:35:50 +02:00
Sreekanth H
53fc2c477b
nmcli: amended the routing-rules4 key values as list (#3401)
* Updated nmcli.py

Amended the routing-rules4 values as list. By this we could add the entries for "routing_rules4" in the form of a list .

* Update nmcli.py 

Fixed typo in line #1701

* 3395-nmcli-needs-type.yml

routing_rules4 module argument is currently accepting only string elements. In order to accept multiple values, amended the type of routing_rules4 as list.

* nmcli: amended the routing-rules4 key values as list

routing_rules4 module argument is currently accepting only string elements. In the case of adding multiple entries to routing_rules4, we need to accept values as list.

* Added 3401-nmcli-needs-type.yml

routing_rules4 module argument is currently accepting only string elements. In the case of adding multiple entries to routing_rules4, we need to accept values as lists

* Amended type to 'minor_changes' 

Amended type to 'minor_changes'  from 'bug_fixes'

* routing_rules4 to a list of element str

nmcli.py - routing_rules4 to a list of element str

* Update changelogs/fragments/3401-nmcli-needs-type.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* nmcli: allow routing-rules4 key values as list

* nmcli: amended the routing-rules4 key values as list

* nmcli: amended the routing-rules4 key values as list

* nmcli: amended the routing-rules4 key values as list

* test_nmcli: amended whitespaces

* Update 3401-nmcli-needs-type.yml

Co-authored-by: Felix Fontein <felix@fontein.de>
2021-09-29 06:49:49 +02:00
Felix Fontein
71a655193c Update botmeta sanity test to accept notifications. 2021-09-28 22:39:34 +02:00
Kristian Feldsam
806f1ea3c9
Added OpenNebula inventory plugin (#810)
* Added OpenNebula inventory plugin

Signed-off-by: Kristián Feldsam <feldsam@gmail.com>

* Apply suggestions from code review

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

* Removed matching inventory yaml files ending with "one"

Too general word

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

* Apply suggestions from code review

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Signed-off-by: Kristian Feldsam <feldsam@gmail.com>

* Added BOTMETA

Signed-off-by: Kristian Feldsam <feldsam@gmail.com>

* Moved import

Signed-off-by: Kristian Feldsam <feldsam@gmail.com>

* Fix indentation problem

Signed-off-by: Kristian Feldsam <feldsam@gmail.com>

* Added group_by_labels, refactored so can be unit tested

Signed-off-by: Kristian Feldsam <feldsam@gmail.com>

* Added unit tests

Signed-off-by: Kristian Feldsam <feldsam@gmail.com>

* Removed blank line

Signed-off-by: Kristian Feldsam <feldsam@gmail.com>

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2021-09-28 16:32:15 +02:00
Felix Fontein
3715b6ef46
Diable netcat conflict in zypper tests as one package seems to be no longer available. (#3438) 2021-09-25 17:16:22 +02:00
Felix Fontein
d0563e34a6
grpcio takes 7 minutes to build on Python 3.10 - make sure it's not installed indirectly. (#3435) 2021-09-25 16:55:09 +02:00
Felix Fontein
935348ae78
Fix CI (#3430)
* Restrict to unit tests with devel (to be reverted later).

* Restrict lxml for Python 2.6.

* Revert "Restrict to unit tests with devel (to be reverted later)."

This reverts commit d0d87a8a0f.
2021-09-25 08:43:16 +02:00
Felix Fontein
0d2bcf545e Prepare ansible-core devel branch version bump that is planned for later today. 2021-09-24 18:46:14 +02:00
Hartwig Hauschild
ae6cbc2d82
mail: adding capability to specify ehlo hostname (#3425)
* Adding capability to specify ehlo hostname

* Fixing default for ehlohost

the CI did not like "None" as default in the documentation,
judging from the rest of the definitions omitting that seems to be right

* Update plugins/modules/notification/mail.py

Proper spelling in documentation

Co-authored-by: Ajpantuso <ajpantuso@gmail.com>

* Adding Changelog Fragment

* Update changelogs/fragments/3425-mail_add_configurable_ehlo_hostname.yml

Proper phrasing in changelog

Co-authored-by: Ajpantuso <ajpantuso@gmail.com>

* integration-test for ehlohost parameter

* proper description, increased async-time

changed body of ehlohost-mail to reflect ehlohost
increased async from 30 to 45 as CI failed because
smtp was already down.

Co-authored-by: Ajpantuso <ajpantuso@gmail.com>
2021-09-24 05:30:14 +00:00
Felix Fontein
98d071f61e
Make ready for split-controller testing in ansible-core (#3345)
* Accept context/ in aliases.

* Mark ansible_galaxy_install test as context/controller.

* Fix interfaces_file test.

ci_complete

* Install pyone dependency.

ci_complete
2021-09-21 08:16:42 +02:00
Andreas Botzner
424af85929
Added redis_data module (#3230)
* Added redis_set module

Added redis_set module and unit tests for the new module.
Applied suggested changes and removed redis_del in favor of state
option.
Also added redis utility class that handles connection.

* Typos, added version and BOTMETA

* Fixed import error checking

* Fixed Unit tests

* Docfix and return consistency

* Added Check Mode

* Update plugins/modules/database/misc/redis_data.py

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
2021-09-20 19:47:23 +02:00
Alexei Znamensky
2ad7ed4f83
kernel_blacklist - revamped the module (#3329)
* kernel_blacklist - revamped the module

* file default and setting "lines" when file does not exist

* added changelog fragment

* added change in arg_spec to the documentation block

* Update plugins/modules/system/kernel_blacklist.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/system/kernel_blacklist.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/system/kernel_blacklist.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* fixed: initialize self.pattern before self.var.is_blacklisted

* File writing recoded

* added try/finally for the file

* multiple changes:

- fixed case when last line of the existing file has no newline char
- added integration tests

* PR: integration test now using remote_tmp_dir

Co-authored-by: Felix Fontein <felix@fontein.de>
2021-09-20 19:39:35 +02:00
Laurent Paumier
2589e9a030
Add keycloak_user_federation module (#3340)
* new module

* fix unit tests

* fix documentation

* more fixes

* fix linefeeds

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

* use true/false instead of True/False

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

* fix result content + rename variable

* urlencode parameters

Co-authored-by: Felix Fontein <felix@fontein.de>
2021-09-20 19:19:42 +02:00
Chris Frage
9ce1009643
Add require_two_factor_authentication property to gitlab group (#3367)
* feat: add require_two_factor_authentication property

* chore: add changelog fragment

* chore: add gitlab_group test tasks

* chore: add gitlab tests

* chore: add gitlab group tests

* docs: apply suggestions

* fix: removing default value
2021-09-20 06:55:43 +02:00