Compare commits

..

68 Commits
3.8.3 ... 3.8.6

Author SHA1 Message Date
Felix Fontein
92203378fd Release 3.8.6. 2022-04-05 14:01:54 +02:00
patchback[bot]
bf1a0450fe Fix small typo (#4452) (#4453)
(cherry picked from commit 380de2d0c1)

Co-authored-by: Wouter Schoot <wouter@schoot.org>
2022-04-05 14:00:37 +02:00
Felix Fontein
1d2e10b812 Prepare 3.8.6 release. 2022-04-05 07:53:11 +02:00
patchback[bot]
77c42e7e18 Bug fix: Warns user if incorrect SDK version is installed (#4422) (#4449)
* Add error handling to check correct SDK version installed

* Fix CI errors

* Added changelog fragment

* Changed exeption type

* Update changelogs fragment

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

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

Co-authored-by: Ricky White <rickywhite@outlook.com>
2022-04-05 07:49:27 +02:00
patchback[bot]
a339f97d89 Bugfix: zypper issue with specified package versions (#4421) (#4445)
* fixed issue with specified package versions

zypper.py was doing nothing on state=present, when ALL requestet/checked packages had a specific version stated. This was caused by get_installed_state() being called with an empty package list, which in this case returns information about all ALL installed packages. This lead to an exessive filter list prerun_state, essentially removing all packages that are installed in ANY version on the target system from the request list.

* Create 4421-zypper_package_version_handling_fix

added changelog fragment for https://github.com/ansible-collections/community.general/pull/4421

* Delete 4421-zypper_package_version_handling_fix

* Create 4421-zypper_package_version_handling_fix.yml

(cherry picked from commit bbe231e261)

Co-authored-by: tover99 <101673769+tover99@users.noreply.github.com>
2022-04-05 06:28:18 +02:00
patchback[bot]
75dce4b1de Replace antsibull-lint collection-docs with antsibull-docs lint-collection-docs. (#4423) (#4425)
(cherry picked from commit 668bbed602)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-03-30 08:17:32 +02:00
Felix Fontein
ec2fa9fa52 Replace devel with stable-2.13. (#4412) 2022-03-29 06:14:13 +02:00
patchback[bot]
e40cb558c6 ldap: added documentation as requested (#4389) (#4397)
* added documentation as requested

* Update plugins/doc_fragments/ldap.py

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

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

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2022-03-24 06:44:28 +00:00
patchback[bot]
9552140d23 Fixed typo in keycloak_client_rolemapping examples (#4393) (#4400)
* Fixed typo in keycloak_client_rolemapping examples

* Add a changelog fragment.

* Removed changelogs fragment for docs-only change.

Co-authored-by: shnee <shnee@shnee.net>
(cherry picked from commit cb30eb2d30)

Co-authored-by: shnee <CurtyD13@gmail.com>
2022-03-24 06:44:12 +00:00
Felix Fontein
83d1c6ea8f Remove default for required=true option. (#4376) 2022-03-18 20:19:24 +00:00
patchback[bot]
c572ff2501 Revert "Allow complex values in variables parameter of terraform module (#4281)" (#4368) (#4369)
This reverts commit 4cc7f41395.

(cherry picked from commit 9618fb9786)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-03-16 07:22:03 +01:00
patchback[bot]
e8d276e689 Proxmox inventory plugin - Fix string to dict conversion (#4349) (#4365)
* Proxmox inventory plugin - Fix string to dict conversion (#4348)

  * Re-use the (defined but unused) `plaintext_configs` variable to list
    configuration entries that should be ignored by the string to
    dictionary conversion code. At this point, it only contains the
    `description` string.
  * Convert to a dictionary if the all substrings obtained by splitting
    off the initial value with commas contain a `=` character
  * Limit substring splitting to a single split, so that a substring
    containing `a=b=c` will generate an `a` entry with value `b=c`.

* Added changelog fragment for PR #4349

* Fix changelog fragment for #4349

(cherry picked from commit 3eec63421a)

Co-authored-by: Emmanuel Benoît <tseeker@nocternity.net>
2022-03-15 12:34:29 +01:00
Felix Fontein
78113c061b Fix sanity issues. (#4346) (#4358)
(cherry picked from commit ca2c64b5ca)
2022-03-14 21:30:52 +01:00
patchback[bot]
2ffcda21dd Update doc. tss.py (env REQUESTS_CA_BUNDLE) (#4338) (#4344)
* Update doc. tss.py (env REQUESTS_CA_BUNDLE)

Add a reference to environment variable REQUESTS_CA_BUNDLE to enable using self signed certificates (on-prem server) in documentation.

* Update tss.py

Remove trailing blank

* Update plugins/lookup/tss.py

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

* Update plugins/lookup/tss.py

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

* Update plugins/lookup/tss.py

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

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

Co-authored-by: Josef Fuchs <josef.fuchs@j-fuchs.at>
2022-03-11 07:20:39 +01:00
patchback[bot]
515e6832e6 Allow complex values in variables parameter of terraform module (#4281) (#4340)
* Allow complex values in variables parameter

Signed-off-by: Webster Mudge <wmudge@gmail.com>

* Add changelog fragment

Signed-off-by: Webster Mudge <wmudge@gmail.com>

* Update changelogs fragments formatting

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

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

Co-authored-by: Webster Mudge <wmudge@cloudera.com>
2022-03-11 06:55:57 +01:00
patchback[bot]
a71a35a19e BOTMETA.yml: add new maintainer to gitlab team (#3695) (#4331)
(cherry picked from commit 56e8bf130a)

Co-authored-by: Andrew Klychkov <aklychko@redhat.com>
2022-03-08 08:34:39 +01:00
patchback[bot]
96d191d549 Remove DWSR from BOTMETA.yml (#4323) (#4324)
* Remove DWSR from BOTMETA.yml

I'm no longer using Ansible.

* Update .github/BOTMETA.yml

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

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

Co-authored-by: Brandon McNama <brandonmcnama@outlook.com>
2022-03-07 07:17:24 +01:00
patchback[bot]
e294cc2aa4 filesize: fix alpine linux sparse file (#4288) (#4293)
* fix sparse file creation on Alpine linux

* re-enable tests for Alpine
* remove `conv=sparse` flag (rely only on `seek=fullsize` & `count=0`)
* doc: add a reference to busybox's dd
* doc: remove restrictions for OpenBSD, Solaris & AIX (should work as
  for Alpine linux now)
* add a changelog fragment

* fix typo

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

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

Co-authored-by: quidame <quidame@poivron.org>
2022-02-27 13:55:47 +01:00
patchback[bot]
f7baaafae2 Re-enable ansible_galaxy_install tests. (#4253) (#4254)
(cherry picked from commit 2b0b780ccb)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-02-22 23:16:26 +01:00
Felix Fontein
32dad20033 Next expected release is 3.8.6. 2022-02-22 14:26:25 +01:00
Felix Fontein
231fae71cc Release 3.8.5. 2022-02-22 13:55:08 +01:00
patchback[bot]
f7c8a89328 Fixes for keycloak_user_federation (#4212) (#4251)
* keycloak: fix creating a user federation w/ idempotent id

Creating a user federation while specifying an id (that doesn't exist
yet) will fail with a 404. This commits fix this behavior.

* keycloak: fix user federation mapper duplication

This commit fixes a bug where mappers are duplicated instead of
configured when creating a user federation.

When creating a user federation, some mappers are autogenerated by
keycloak. This commit lets the keycloak_user_federation module recompute
mappers final values after the user federation is created so that the
module can try to merge them by their name.

* add missing fragment for pr #4212

(cherry picked from commit c1485b885d)

Co-authored-by: Jules Lamur <jlamur@users.noreply.github.com>
2022-02-22 09:08:42 +00:00
patchback[bot]
b0e518967d Temporarily disable ansible_galaxy_install tests due to Galaxy failures. (#4247) (#4249)
(cherry picked from commit 06705348e3)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-02-22 09:39:50 +01:00
patchback[bot]
55a3ca024d Fix module failure due to itertools.izip_longest (#4211) (#4237)
* Fix module failure due to itertools.izip_longest

* Add changelog fragment. Remove itertools import

* Update changelogs/fragments/4206-imc-rest-module.yaml

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

Co-authored-by: Boris Vasilev <bvasilev@vmware.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 40f9445aea)

Co-authored-by: Boris <borisvasilev395@gmail.com>
2022-02-20 09:53:45 +01:00
patchback[bot]
323c95437b [PR #4183/f5ec7373 backport][stable-3] yum_versionlock: Fix entry matching (#4227)
* yum_versionlock: Fix entry matching (#4183)

As an input the module receives names of packages to lock.
Those never matched existing entries and therefore always reported
changes.

For compatibility yum is symlinked to dnf on newer systems,
but versionlock entries defer. Try to parse both formats.

Signed-off-by: Florian Achleitner <flo@fopen.at>
(cherry picked from commit f5ec73735f)

* Empty commit to trigger CI.

Co-authored-by: fachleitner <flo@fopen.at>
Co-authored-by: Felix Fontein <felix@fontein.de>
2022-02-18 23:32:18 +01:00
patchback[bot]
2473c08ed2 Drop CentOS 8 from CI. (#4139) (#4230)
(cherry picked from commit b444dc81a1)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-02-18 22:31:22 +01:00
patchback[bot]
e879afd802 passwordstore: Fix error detection for non-English locales (#4219) (#4220)
The passwordstore lookup plugin depends on parsing GnuPG's
error messages in English language. As a result, detection of
a specific error failes when users set a different locale.

This change corrects this by setting the `LANGUAGE` environment
variable to `C` when invoking `pass`, as this only affects
gettext translations.

See
https://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html

(cherry picked from commit 77a0c139c9)

Co-authored-by: grembo <freebsd@grem.de>
2022-02-17 22:21:06 +01:00
patchback[bot]
56c5a8b9b2 passwordstore: Prevent using path as password (#4192) (#4217)
Given a password stored in _path/to/secret_, requesting the password
_path/to_ will literally return `path/to`. This can lead to using
weak passwords by accident/mess up logic in code, based on the
state of the password store.

This is worked around by applying the same logic `pass` uses:
If a password was returned, check if there is a .gpg file it could
have come from. If not, treat it as missing.

Fixes ansible-collections/community.general#4185

(cherry picked from commit da49c0968d)

Co-authored-by: grembo <freebsd@grem.de>
2022-02-17 21:33:09 +01:00
patchback[bot]
78de6f2494 Allow YAML docs in plugins/test/ and plugins/filters/. (#4204) (#4215)
(cherry picked from commit 1e4b8e30a9)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-02-17 19:44:28 +01:00
patchback[bot]
316b36862f ini_file: Don't report changed=true when removing if nothing is changed. (#4155) (#4213)
* don't report changed when nothing is removed

* add change log

* linter happy

* Update plugins/modules/files/ini_file.py

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

* Update changelogs/fragments/4154-ini_file_changed.yml

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

* add absent idempotency test

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

Co-authored-by: James Livulpi <james.livulpi@me.com>
2022-02-17 13:51:03 +01:00
patchback[bot]
a110f6eb4b Add nejch and lgatellier as GitLab module maintainers. (#4199) (#4200)
(cherry picked from commit 7b02adc57e)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-02-14 21:10:03 +01:00
patchback[bot]
512a46a18c dconf: Skip processes that disappeared while we inspected them (#4153) (#4181)
* dconf: Skip processes that disappeared while we inspected them

Fixes #4151

* Update changelogs/fragments/4151-dconf-catch-psutil-nosuchprocess.yaml

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

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

Co-authored-by: Pavol Babinčák‏ <scroolik@gmail.com>
2022-02-10 07:29:35 +01:00
patchback[bot]
d97c7aa777 vdo: Remove unused variable (#4163) (#4169)
* fix vdo error #3916

* add changelog fragment

(cherry picked from commit acd8853242)

Co-authored-by: Joseph Torcasso <87090265+jatorcasso@users.noreply.github.com>
2022-02-07 20:21:10 +01:00
patchback[bot]
4a32f7bc56 Update Proxmox Inventory Documentation with additional examples (#4148) (#4158)
* Update Documentation with additional example

* Added an example to have the plugin return an IP address for a Proxmox guest, instead of the name of the guest (default behavior)
* Added an example to include a string literal to every guest (to support a playbook being able to check for variable presence to identify inventory in use)

* Update for line length readability

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

* Changed to cleaner static value

* Changed text for clarity

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

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

Co-authored-by: IronTooch <27360514+IronTooch@users.noreply.github.com>
2022-02-05 21:57:10 +01:00
patchback[bot]
49ae02d445 Fix return value documentation to use a valid value for 'type'. (#4142) (#4146)
(cherry picked from commit 9322809b3a)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-02-02 22:16:14 +01:00
patchback[bot]
1b609a34ae homebrew_cask: reinstall when force is install option (#4090) (#4144)
* homebrew_cask: reinstall when force is install option

* add changelog entry

* Fix OSX CI runs - run as non-root

* test with cask that has no macos dependencies

* use `brooklyn` cask to test

(cherry picked from commit 8b95c56030)

Co-authored-by: Joseph Torcasso <87090265+jatorcasso@users.noreply.github.com>
2022-02-02 22:00:33 +01:00
patchback[bot]
e6c90cc52c Try to fix CentOS 8 in CI - at least a bit. (#4132) (#4137)
(cherry picked from commit 24f7a3b6ad)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-01-31 21:54:26 +01:00
patchback[bot]
15a80aa004 gitlab: use gitlab instance runner to create runner (#3965) (#4122)
When using project it will use project level runner to create runner that based on python-gitlab it will be used for enabling runner and needs a runner_id so for creating a new runner it should use gitlab level runner

Signed-off-by: Seena Fallah <seenafallah@gmail.com>
(cherry picked from commit 929136808f)

Co-authored-by: Seena Fallah <seenafallah@gmail.com>
2022-01-31 06:19:59 +01:00
Felix Fontein
b9ea3ce19b Prepare 3.8.5 release. 2022-01-30 15:17:43 +01:00
patchback[bot]
f314ab6679 PyOpenSSL 22.0.0 no longer supports Python 2.7 (#4114) (#4117)
* PyOpenSSL 22.0.0 no longer supports Python 2.7.

* Try to make pip on CentOS 6 happy.

(cherry picked from commit 84124224ae)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-01-30 15:07:46 +01:00
patchback[bot]
25778a8da4 python_requirements_info: don't overwrite results in 'mismatched' dict key (#4078) (#4110)
* bugfix: don't overwrite results in 'mismatched'

Whichever mismatched package is evaluated last is the value stored in the
'mismatched' key. Instead, it should have a subdict for each pkg that is mismatched
to keep in line with its documented usage.

* Update changelogs/fragments/4078-python_requirements_info.yaml

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

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

Co-authored-by: Will Hegedus <will@wbhegedus.me>
2022-01-29 15:19:47 +00:00
patchback[bot]
c40a1e561a Actually expand ~ in yarn global install folder (#4048) (#4099)
* Fix 'changed' status for yarn global by actually expanding ~

* Ignore use-argspec-type-path test

* Add changelog fragment

* Update changelogs/fragments/4048-expand-tilde-in-yarn-global-install-folder.yaml

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

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

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2022-01-28 07:41:33 +01:00
patchback[bot]
aaee4a5a59 Properly parse JSON Lines output from yarn (#4050) (#4097)
* Properly parse JSON Lines output from yarn

* Properly support output of yarn global list

* Add changelog fragment

* Check that the string starts with 'bins-'

* Fix changelog fragment

* Update changelogs/fragments/4050-properly-parse-json-lines-output-from-yarn.yaml

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

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

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2022-01-28 07:38:29 +01:00
patchback[bot]
e600fe573f Fix missing '>'. (#4080) (#4081)
(cherry picked from commit 5fead8bbde)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-01-25 08:04:37 +01:00
patchback[bot]
3f79a173a8 Improve documentation on how to run tests (#4070) (#4071)
* Improve documentation on how to run tests.

* Fix incomplete sentence.

* Apply suggestions from code review

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

* Improve separation.

* Fix unrelated typo.

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
(cherry picked from commit 8a03d9f286)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-01-21 19:55:10 +01:00
patchback[bot]
08eac051f4 Fix exception in the mail callback plugin (#4026) (#4063)
(cherry picked from commit c7500c217f)

Co-authored-by: Lénaïc Huard <L3n41c@users.noreply.github.com>
2022-01-20 09:30:06 +01:00
patchback[bot]
5f20d7f109 Update CI matrix for Remote Devel. (#4033) (#4034)
(cherry picked from commit 3faffe8f47)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-01-13 09:07:17 +01:00
Felix Fontein
96f8d1b8a1 Next expected release is 3.8.5. 2022-01-11 07:23:00 +01:00
Felix Fontein
f7276b152b Release 3.8.4. 2022-01-11 06:41:56 +01:00
Felix Fontein
5e503bfcc7 Prepare 3.8.4 release. 2022-01-10 23:06:20 +01:00
patchback[bot]
d2b4151b7a fix alternatives parsing when they are part of a group (#3976) (#4020)
* fix alternatives parsing when they are part of a group

* add changelog fragment

Co-authored-by: Guillaume Rousse <guillaume.rousse@renater.fr>
(cherry picked from commit a675afcba9)

Co-authored-by: Guillaume Rousse <guillomovitch@gmail.com>
2022-01-10 07:27:12 +01:00
patchback[bot]
57b73e0d5e Fix example code for flattened lookup (#4013) (#4015)
Co-authored-by: Lee Garrett <lgarrett@rocketjump.eu>
(cherry picked from commit d19ab93faf)

Co-authored-by: Lee Garrett <leegarrett@users.noreply.github.com>
2022-01-09 12:29:19 +01:00
patchback[bot]
5f47d47f27 Restrict PyNaCL to 1.4.x on RHEL8 when using Python 3.6 (#4006) (#4009)
* Restrict PyNaCL to 1.4.x on RHEL8 when using Python 3.6.

* Fix typo.

(cherry picked from commit 77a930cf6b)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-01-08 15:07:00 +01:00
patchback[bot]
7e2f20f482 Fix 2.9 unit tests (#4002) (#4004)
* Fix 2.9 unit tests.

* Another try.

(cherry picked from commit 26a91e811f)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-01-08 12:40:05 +01:00
patchback[bot]
3023312334 Fix comment. (#3993) (#3994)
(cherry picked from commit a6a8cd02b6)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-01-06 15:10:46 +01:00
Felix Fontein
fe3de232f0 Fix BOTMETA and corresponding sanity test (#3989) (#3991)
* Fix BOTMETA and authors mistakes.

* Fix BOTMETA sanity test regex.

(cherry picked from commit 11205eefee)
2022-01-06 06:56:10 +01:00
patchback[bot]
2024dc37af Use vendored copy of distutils.version. (#3984) (#3986)
(cherry picked from commit cf7a33356c)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-01-05 22:05:06 +01:00
Felix Fontein
b8469a5c28 Re-enable snap tests (#3967) (#3982)
* Re-enable snap tests.

* Skip tests on RHEL 8.2 and 8.3.

* Refactor snap setup.

* Try to simplify setup.

(cherry picked from commit bb78d98f8f)
2022-01-05 18:12:03 +01:00
patchback[bot]
2a0ec9c572 Get rid of distutils.spawn and distutils.util (#3934) (#3973)
* Replace distutils.spawn.find_executable.

* Replace distutils.util.strtobool.

(cherry picked from commit 77b7b4f75b)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-01-04 07:27:02 +01:00
patchback[bot]
fa92f8efb0 slack - use UTF-8 charset in content-type header (#3933) (#3970)
* Use UTF-8 charset in content-type header

* Add changelog fragment

(cherry picked from commit a4ab85fd68)

Co-authored-by: bluikko <14869000+bluikko@users.noreply.github.com>
2022-01-03 19:43:47 +01:00
patchback[bot]
03e068e298 Restrict redis to < 4.1.0 for ansible-base 2.10. (#3955) (#3958)
(cherry picked from commit 3f2364574d)

Co-authored-by: Felix Fontein <felix@fontein.de>
2021-12-27 21:17:06 +01:00
patchback[bot]
8f084ac065 fix scaleway_user_data (#3940) (#3953)
* fix  scaleway_user_data

scaleway_user_data put cloud-init valuer with 2 unexpected " (begin and end of value)

If Content-Type is not change , it's jsonify ( file module_utils/scaleway.py ligne 131 )

fix the probleme  when "Content-Type" is used instead of "Content-type"

* Create 3940_fix_contenttype_scaleway_user_data.yml

* Update changelogs/fragments/3940_fix_contenttype_scaleway_user_data.yml

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

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

Co-authored-by: pmangin <96626847+pmangin@users.noreply.github.com>
2021-12-27 19:55:43 +01:00
Felix Fontein
e02568d28a Prepare for distutils.version being removed in Python 3.12 (#3936) (#3942)
* Prepare for distutils.version being removed in Python 2.12.

* Fix copy'n'paste error.

* Re-add Loose prefix.

* Fix Python version typos.

* Improve formulation.

* Move message into own line.

* Fix casing, now that the object is no longer called Version.

(cherry picked from commit a2f72be6c8)
2021-12-24 19:15:51 +01:00
patchback[bot]
73580d09e0 Fix filesystem tests (so they run on their own) (#3937) (#3938)
* Don't use loops for installing packages.

* Install util-linux-systemd on OpenSuSE so that findmnt is around.

(cherry picked from commit f34c454412)

Co-authored-by: Felix Fontein <felix@fontein.de>
2021-12-23 12:38:22 +01:00
Felix Fontein
093036a2ae Disable snap tests. (#3922) (#3924)
(cherry picked from commit 51838adf8c)
2021-12-20 10:59:11 +01:00
patchback[bot]
7f1de4869e Fix nrdp string arguments without an encoding (#3909) (#3911)
* Fix nrdp string arguments without an encoding

* added changelog fragment

Signed-off-by: Jesse Harris <zigford@gmail.com>

* Update changelogs/fragments/3909-nrdp_fix_string_args_without_encoding.yaml

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

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

Co-authored-by: Jesse Harris <zigford@gmail.com>
2021-12-17 22:13:50 +01:00
patchback[bot]
8df1b93531 jira - fixed 'body' dict key error (#3867) (#3913)
* fixed

* added changelog fragment

* improved fail output when placing JIRA API requests

* Update plugins/modules/web_infrastructure/jira.py

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

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

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2021-12-17 22:13:21 +01:00
Felix Fontein
c055ea2bcc Next expected release is 3.8.4. 2021-12-14 07:57:25 +01:00
126 changed files with 1099 additions and 268 deletions

View File

@@ -55,14 +55,14 @@ pool: Standard
stages:
### Sanity
- stage: Sanity_devel
displayName: Sanity devel
- stage: Sanity_2_13
displayName: Sanity 2.13
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
nameFormat: Test {0}
testFormat: devel/sanity/{0}
testFormat: 2.13/sanity/{0}
targets:
- test: 1
- test: 2
@@ -122,14 +122,14 @@ stages:
- test: 3
- test: 4
### Units
- stage: Units_devel
displayName: Units devel
- stage: Units_2_13
displayName: Units 2.13
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
nameFormat: Python {0}
testFormat: devel/units/{0}/1
testFormat: 2.13/units/{0}/1
targets:
- test: 2.7
- test: 3.5
@@ -198,22 +198,22 @@ stages:
- test: 3.8
## Remote
- stage: Remote_devel
displayName: Remote devel
- stage: Remote_2_13
displayName: Remote 2.13
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
testFormat: devel/{0}
testFormat: 2.13/{0}
targets:
- name: macOS 11.1
test: macos/11.1
- name: macOS 12.0
test: macos/12.0
- name: RHEL 7.9
test: rhel/7.9
- name: RHEL 8.5
test: rhel/8.5
- name: FreeBSD 12.2
test: freebsd/12.2
- name: FreeBSD 12.3
test: freebsd/12.3
- name: FreeBSD 13.0
test: freebsd/13.0
groups:
@@ -288,13 +288,13 @@ stages:
- 2
### Docker
- stage: Docker_devel
displayName: Docker devel
- stage: Docker_2_13
displayName: Docker 2.13
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
testFormat: devel/linux/{0}
testFormat: 2.13/linux/{0}
targets:
- name: CentOS 7
test: centos7
@@ -324,8 +324,6 @@ stages:
targets:
- name: CentOS 6
test: centos6
- name: CentOS 8
test: centos8
- name: Fedora 34
test: fedora34
- name: openSUSE 15 py3
@@ -385,14 +383,14 @@ stages:
- 3
### Cloud
- stage: Cloud_devel
displayName: Cloud devel
- stage: Cloud_2_13
displayName: Cloud 2.13
dependsOn: []
jobs:
- template: templates/matrix.yml
parameters:
nameFormat: Python {0}
testFormat: devel/cloud/{0}/1
testFormat: 2.13/cloud/{0}/1
targets:
- test: 2.7
- test: 3.9
@@ -439,27 +437,27 @@ stages:
- stage: Summary
condition: succeededOrFailed()
dependsOn:
- Sanity_devel
- Sanity_2_13
- Sanity_2_9
- Sanity_2_10
- Sanity_2_11
- Sanity_2_12
- Units_devel
- Units_2_13
- Units_2_9
- Units_2_10
- Units_2_11
- Units_2_12
- Remote_devel
- Remote_2_13
- Remote_2_9
- Remote_2_10
- Remote_2_11
- Remote_2_12
- Docker_devel
- Docker_2_13
- Docker_2_9
- Docker_2_10
- Docker_2_11
- Docker_2_12
- Cloud_devel
- Cloud_2_13
- Cloud_2_9
- Cloud_2_10
- Cloud_2_11

15
.github/BOTMETA.yml vendored
View File

@@ -164,7 +164,7 @@ files:
$inventories/proxmox.py:
maintainers: $team_virt ilijamt
$inventories/icinga2.py:
maintainers: bongoeadgc6
maintainers: BongoEADGC6
$inventories/scaleway.py:
maintainers: $team_scaleway
labels: cloud scaleway
@@ -320,6 +320,10 @@ files:
$modules/cloud/misc/proxmox_kvm.py:
maintainers: helldorado
ignore: skvidal
$modules/cloud/misc/proxmox_nic.py:
maintainers: Kogelvis
$modules/cloud/misc/proxmox_tasks_info:
maintainers: paginabianca
$modules/cloud/misc/proxmox_template.py:
maintainers: UnderGreen
ignore: skvidal
@@ -914,6 +918,10 @@ files:
$modules/remote_management/manageiq/:
labels: manageiq
maintainers: $team_manageiq
$modules/remote_management/manageiq/manageiq_alert_profiles.py:
maintainers: elad661
$modules/remote_management/manageiq/manageiq_alerts.py:
maintainers: elad661
$modules/remote_management/manageiq/manageiq_group.py:
maintainers: evertmulder
$modules/remote_management/manageiq/manageiq_tenant.py:
@@ -1155,7 +1163,8 @@ files:
$modules/web_infrastructure/jenkins_script.py:
maintainers: hogarthj
$modules/web_infrastructure/jira.py:
maintainers: Slezhuk tarka pertoft DWSR
maintainers: Slezhuk tarka pertoft
ignore: DWSR
labels: jira
$modules/web_infrastructure/nginx_status_info.py:
maintainers: resmo
@@ -1221,7 +1230,7 @@ macros:
team_cyberark_conjur: jvanderhoof ryanprior
team_e_spirit: MatrixCrawler getjack
team_flatpak: JayKayy oolongbrothers
team_gitlab: Lunik Shaps dj-wasabi marwatk waheedi zanssa scodeman metanovii sh0shin
team_gitlab: Lunik Shaps dj-wasabi marwatk waheedi zanssa scodeman metanovii sh0shin nejch lgatellier suukit
team_hpux: bcoca davx8342
team_huawei: QijunPan TommyLike edisonxiang freesky-edward hwDCN niuzhenguo xuxiaowei0512 yanzhangi zengchen1024 zhongjun2
team_ipa: Akasurde Nosmoht fxfitz justchris1

View File

@@ -6,6 +6,74 @@ Community General Release Notes
This changelog describes changes after version 2.0.0.
v3.8.6
======
Release Summary
---------------
Regular bugfix release.
Bugfixes
--------
- dsv lookup plugin - raise an Ansible error if the wrong ``python-dsv-sdk`` version is installed (https://github.com/ansible-collections/community.general/pull/4422).
- filesize - add support for busybox dd implementation, that is used by default on Alpine linux (https://github.com/ansible-collections/community.general/pull/4288, https://github.com/ansible-collections/community.general/issues/4259).
- proxmox inventory plugin - always convert strings that follow the ``key=value[,key=value[...]]`` form into dictionaries (https://github.com/ansible-collections/community.general/pull/4349).
- proxmox inventory plugin - fixed the ``description`` field being ignored if it contained a comma (https://github.com/ansible-collections/community.general/issues/4348).
- zypper - fixed bug that caused zypper to always report [ok] and do nothing on ``state=present`` when all packages in ``name`` had a version specification (https://github.com/ansible-collections/community.general/issues/4371, https://github.com/ansible-collections/community.general/pull/4421).
v3.8.5
======
Release Summary
---------------
Regular bugfix release.
Bugfixes
--------
- dconf - skip processes that disappeared while we inspected them (https://github.com/ansible-collections/community.general/issues/4151).
- gitlab_runner - use correct API endpoint to create and retrieve project level runners when using ``project`` (https://github.com/ansible-collections/community.general/pull/3965).
- homebrew_cask - fix force install operation (https://github.com/ansible-collections/community.general/issues/3703).
- imc_rest - fixes the module failure due to the usage of ``itertools.izip_longest`` which is not available in Python 3 (https://github.com/ansible-collections/community.general/issues/4206).
- ini_file - when removing nothing do not report changed (https://github.com/ansible-collections/community.general/issues/4154).
- keycloak_user_federation - creating a user federation while specifying an ID (that does not exist yet) no longer fail with a 404 Not Found (https://github.com/ansible-collections/community.general/pull/4212).
- keycloak_user_federation - mappers auto-created by keycloak are matched and merged by their name and no longer create duplicated entries (https://github.com/ansible-collections/community.general/pull/4212).
- mail callback plugin - fix crash on Python 3 (https://github.com/ansible-collections/community.general/issues/4025, https://github.com/ansible-collections/community.general/pull/4026).
- passwordstore lookup plugin - fix error detection for non-English locales (https://github.com/ansible-collections/community.general/pull/4219).
- passwordstore lookup plugin - prevent returning path names as passwords by accident (https://github.com/ansible-collections/community.general/issues/4185, https://github.com/ansible-collections/community.general/pull/4192).
- python_requirements_info - store ``mismatched`` return values per package as documented in the module (https://github.com/ansible-collections/community.general/pull/4078).
- vdo - fix options error (https://github.com/ansible-collections/community.general/pull/4163).
- yarn - fix incorrect handling of ``yarn list`` and ``yarn global list`` output that could result in fatal error (https://github.com/ansible-collections/community.general/pull/4050).
- yarn - fix incorrectly reported status when installing a package globally (https://github.com/ansible-collections/community.general/issues/4045, https://github.com/ansible-collections/community.general/pull/4050).
- yarn - fix missing ``~`` expansion in yarn global install folder which resulted in incorrect task status (https://github.com/ansible-collections/community.general/issues/4045, https://github.com/ansible-collections/community.general/pull/4048).
- yum_versionlock - fix matching of existing entries with names passed to the module. Match yum and dnf lock format (https://github.com/ansible-collections/community.general/pull/4183).
v3.8.4
======
Release Summary
---------------
Regular bugfix release.
Bugfixes
--------
- Various modules and plugins - use vendored version of ``distutils.version`` instead of the deprecated Python standard library ``distutils`` (https://github.com/ansible-collections/community.general/pull/3936).
- alternatives - fix output parsing for alternatives groups (https://github.com/ansible-collections/community.general/pull/3976).
- jail connection plugin - replace deprecated ``distutils.spawn.find_executable`` with Ansible's ``get_bin_path`` to find the executable (https://github.com/ansible-collections/community.general/pull/3934).
- jira - fixed bug where module returns error related to dictionary key ``body`` (https://github.com/ansible-collections/community.general/issues/3419).
- lxd connection plugin - replace deprecated ``distutils.spawn.find_executable`` with Ansible's ``get_bin_path`` to find the ``lxc`` executable (https://github.com/ansible-collections/community.general/pull/3934).
- nrdp callback plugin - fix error ``string arguments without an encoding`` (https://github.com/ansible-collections/community.general/issues/3903).
- passwordstore lookup plugin - replace deprecated ``distutils.util.strtobool`` with Ansible's ``convert_bool.boolean`` to interpret values for the ``create``, ``returnall``, ``overwrite``, 'backup``, and ``nosymbols`` options (https://github.com/ansible-collections/community.general/pull/3934).
- say callback plugin - replace deprecated ``distutils.spawn.find_executable`` with Ansible's ``get_bin_path`` to find the ``say`` resp. ``espeak`` executables (https://github.com/ansible-collections/community.general/pull/3934).
- scaleway_user_data - fix double-quote added where no double-quote is needed to user data in scaleway's server (``Content-type`` -> ``Content-Type``) (https://github.com/ansible-collections/community.general/pull/3940).
- slack - add ``charset`` to HTTP headers to avoid Slack API warning (https://github.com/ansible-collections/community.general/issues/3932).
- zone connection plugin - replace deprecated ``distutils.spawn.find_executable`` with Ansible's ``get_bin_path`` to find the executable (https://github.com/ansible-collections/community.general/pull/3934).
v3.8.3
======

View File

@@ -24,7 +24,7 @@ Also, consider taking up a valuable, reviewed, but abandoned pull request which
* Try committing your changes with an informative but short commit message.
* Do not squash your commits and force-push to your branch if not needed. Reviews of your pull request are much easier with individual commits to comprehend the pull request history. All commits of your pull request branch will be squashed into one commit by GitHub upon merge.
* Do not add merge commits to your PR. The bot will complain and you will have to rebase ([instructions for rebasing](https://docs.ansible.com/ansible/latest/dev_guide/developing_rebasing.html)) to remove them before your PR can be merged. To avoid that git automatically does merges during pulls, you can configure it to do rebases instead by running `git config pull.rebase true` inside the respository checkout.
* Do not add merge commits to your PR. The bot will complain and you will have to rebase ([instructions for rebasing](https://docs.ansible.com/ansible/latest/dev_guide/developing_rebasing.html)) to remove them before your PR can be merged. To avoid that git automatically does merges during pulls, you can configure it to do rebases instead by running `git config pull.rebase true` inside the repository checkout.
* Make sure your PR includes a [changelog fragment](https://docs.ansible.com/ansible/devel/community/development_process.html#changelogs-how-to). (You must not include a fragment for new modules or new plugins, except for test and filter plugins. Also you shouldn't include one for docs-only changes. If you're not sure, simply don't include one, we'll tell you whether one is needed or not :) )
* Avoid reformatting unrelated parts of the codebase in your PR. These types of changes will likely be requested for reversion, create additional work for reviewers, and may cause approval to be delayed.
@@ -36,6 +36,54 @@ If you want to test a PR locally, refer to [our testing guide](https://github.co
If you find any inconsistencies or places in this document which can be improved, feel free to raise an issue or pull request to fix it.
## Run sanity, unit or integration tests locally
You have to check out the repository into a specific path structure to be able to run `ansible-test`. The path to the git checkout must end with `.../ansible_collections/community/general`. Please see [our testing guide](https://github.com/ansible/community-docs/blob/main/test_pr_locally_guide.rst) for instructions on how to check out the repository into a correct path structure. The short version of these instructions is:
```.bash
mkdir -p ~/dev/ansible_collections/community
git clone https://github.com/ansible-collections/community.general.git ~/dev/ansible_collections/community/general
cd ~/dev/ansible_collections/community/general
```
Then you can run `ansible-test` (which is a part of [ansible-core](https://pypi.org/project/ansible-core/)) inside the checkout. The following example commands expect that you have installed Docker or Podman. Note that Podman has only been supported by more recent ansible-core releases. If you are using Docker, the following will work with Ansible 2.9+.
The following commands show how to run sanity tests:
```.bash
# Run sanity tests for all files in the collection:
ansible-test sanity --docker -v
# Run sanity tests for the given files and directories:
ansible-test sanity --docker -v plugins/modules/system/pids.py tests/integration/targets/pids/
```
The following commands show how to run unit tests:
```.bash
# Run all unit tests:
ansible-test units --docker -v
# Run all unit tests for one Python version (a lot faster):
ansible-test units --docker -v --python 3.8
# Run a specific unit test (for the nmcli module) for one Python version:
ansible-test units --docker -v --python 3.8 tests/unit/plugins/modules/net_tools/test_nmcli.py
```
The following commands show how to run integration tests:
```.bash
# Run integration tests for the interfaces_files module in a Docker container using the
# fedora35 operating system image (the supported images depend on your ansible-core version):
ansible-test integration --docker fedora35 -v interfaces_file
# Run integration tests for the flattened lookup **without any isolation**:
ansible-test integration -v lookup_flattened
```
If you are unsure about the integration test target name for a module or plugin, you can take a look in `tests/integration/targets/`. Tests for plugins have the plugin type prepended.
## Creating new modules or plugins
Creating new modules and plugins requires a bit more work than other Pull Requests.

View File

@@ -17,7 +17,7 @@ If you encounter abusive behavior violating the [Ansible Code of Conduct](https:
## Tested with Ansible
Tested with the current Ansible 2.9, ansible-base 2.10, ansible-core 2.11, ansible-core 2.12 releases and the current development version of ansible-core. Ansible versions before 2.9.10 are not supported.
Tested with the current Ansible 2.9, ansible-base 2.10, ansible-core 2.11, ansible-core 2.12 and ansible-core 2.13 releases. Ansible versions before 2.9.10 are not supported.
## External requirements

View File

@@ -2030,3 +2030,113 @@ releases:
- 3874-proxmox-fix-onboot-param.yml
- 3896-nmcli_vlan_missing_options.yaml
release_date: '2021-12-14'
3.8.4:
changes:
bugfixes:
- Various modules and plugins - use vendored version of ``distutils.version``
instead of the deprecated Python standard library ``distutils`` (https://github.com/ansible-collections/community.general/pull/3936).
- alternatives - fix output parsing for alternatives groups (https://github.com/ansible-collections/community.general/pull/3976).
- jail connection plugin - replace deprecated ``distutils.spawn.find_executable``
with Ansible's ``get_bin_path`` to find the executable (https://github.com/ansible-collections/community.general/pull/3934).
- jira - fixed bug where module returns error related to dictionary key ``body``
(https://github.com/ansible-collections/community.general/issues/3419).
- lxd connection plugin - replace deprecated ``distutils.spawn.find_executable``
with Ansible's ``get_bin_path`` to find the ``lxc`` executable (https://github.com/ansible-collections/community.general/pull/3934).
- nrdp callback plugin - fix error ``string arguments without an encoding``
(https://github.com/ansible-collections/community.general/issues/3903).
- passwordstore lookup plugin - replace deprecated ``distutils.util.strtobool``
with Ansible's ``convert_bool.boolean`` to interpret values for the ``create``,
``returnall``, ``overwrite``, 'backup``, and ``nosymbols`` options (https://github.com/ansible-collections/community.general/pull/3934).
- say callback plugin - replace deprecated ``distutils.spawn.find_executable``
with Ansible's ``get_bin_path`` to find the ``say`` resp. ``espeak`` executables
(https://github.com/ansible-collections/community.general/pull/3934).
- scaleway_user_data - fix double-quote added where no double-quote is needed
to user data in scaleway's server (``Content-type`` -> ``Content-Type``) (https://github.com/ansible-collections/community.general/pull/3940).
- slack - add ``charset`` to HTTP headers to avoid Slack API warning (https://github.com/ansible-collections/community.general/issues/3932).
- zone connection plugin - replace deprecated ``distutils.spawn.find_executable``
with Ansible's ``get_bin_path`` to find the executable (https://github.com/ansible-collections/community.general/pull/3934).
release_summary: Regular bugfix release.
fragments:
- 3.8.4.yml
- 3867-jira-fix-body.yaml
- 3909-nrdp_fix_string_args_without_encoding.yaml
- 3933-slack-charset-header.yaml
- 3934-distutils.yml
- 3936-distutils.version.yml
- 3940_fix_contenttype_scaleway_user_data.yml
- 3976-fix-alternatives-parsing.yml
release_date: '2022-01-11'
3.8.5:
changes:
bugfixes:
- dconf - skip processes that disappeared while we inspected them (https://github.com/ansible-collections/community.general/issues/4151).
- gitlab_runner - use correct API endpoint to create and retrieve project level
runners when using ``project`` (https://github.com/ansible-collections/community.general/pull/3965).
- homebrew_cask - fix force install operation (https://github.com/ansible-collections/community.general/issues/3703).
- imc_rest - fixes the module failure due to the usage of ``itertools.izip_longest``
which is not available in Python 3 (https://github.com/ansible-collections/community.general/issues/4206).
- ini_file - when removing nothing do not report changed (https://github.com/ansible-collections/community.general/issues/4154).
- keycloak_user_federation - creating a user federation while specifying an
ID (that does not exist yet) no longer fail with a 404 Not Found (https://github.com/ansible-collections/community.general/pull/4212).
- keycloak_user_federation - mappers auto-created by keycloak are matched and
merged by their name and no longer create duplicated entries (https://github.com/ansible-collections/community.general/pull/4212).
- mail callback plugin - fix crash on Python 3 (https://github.com/ansible-collections/community.general/issues/4025,
https://github.com/ansible-collections/community.general/pull/4026).
- passwordstore lookup plugin - fix error detection for non-English locales
(https://github.com/ansible-collections/community.general/pull/4219).
- passwordstore lookup plugin - prevent returning path names as passwords by
accident (https://github.com/ansible-collections/community.general/issues/4185,
https://github.com/ansible-collections/community.general/pull/4192).
- python_requirements_info - store ``mismatched`` return values per package
as documented in the module (https://github.com/ansible-collections/community.general/pull/4078).
- vdo - fix options error (https://github.com/ansible-collections/community.general/pull/4163).
- yarn - fix incorrect handling of ``yarn list`` and ``yarn global list`` output
that could result in fatal error (https://github.com/ansible-collections/community.general/pull/4050).
- yarn - fix incorrectly reported status when installing a package globally
(https://github.com/ansible-collections/community.general/issues/4045, https://github.com/ansible-collections/community.general/pull/4050).
- yarn - fix missing ``~`` expansion in yarn global install folder which resulted
in incorrect task status (https://github.com/ansible-collections/community.general/issues/4045,
https://github.com/ansible-collections/community.general/pull/4048).
- yum_versionlock - fix matching of existing entries with names passed to the
module. Match yum and dnf lock format (https://github.com/ansible-collections/community.general/pull/4183).
release_summary: Regular bugfix release.
fragments:
- 3.8.5.yml
- 3703-force-install-homebrew-cask.yml
- 3916-fix-vdo-options-type.yml
- 3935-use-gitlab-instance-runner-to-create-runner.yml
- 4026-fix-mail-callback.yml
- 4048-expand-tilde-in-yarn-global-install-folder.yaml
- 4050-properly-parse-json-lines-output-from-yarn.yaml
- 4078-python_requirements_info.yaml
- 4151-dconf-catch-psutil-nosuchprocess.yaml
- 4154-ini_file_changed.yml
- 4183-fix-yum_versionlock.yaml
- 4192-improve-passwordstore-consistency.yml
- 4206-imc-rest-module.yaml
- 4212-fixes-for-keycloak-user-federation.yml
- 4219-passwordstore-locale-fix.yml
release_date: '2022-02-22'
3.8.6:
changes:
bugfixes:
- dsv lookup plugin - raise an Ansible error if the wrong ``python-dsv-sdk``
version is installed (https://github.com/ansible-collections/community.general/pull/4422).
- filesize - add support for busybox dd implementation, that is used by default
on Alpine linux (https://github.com/ansible-collections/community.general/pull/4288,
https://github.com/ansible-collections/community.general/issues/4259).
- proxmox inventory plugin - always convert strings that follow the ``key=value[,key=value[...]]``
form into dictionaries (https://github.com/ansible-collections/community.general/pull/4349).
- proxmox inventory plugin - fixed the ``description`` field being ignored if
it contained a comma (https://github.com/ansible-collections/community.general/issues/4348).
- zypper - fixed bug that caused zypper to always report [ok] and do nothing
on ``state=present`` when all packages in ``name`` had a version specification
(https://github.com/ansible-collections/community.general/issues/4371, https://github.com/ansible-collections/community.general/pull/4421).
release_summary: Regular bugfix release.
fragments:
- 3.8.6.yml
- 4288-fix-4259-support-busybox-dd.yml
- 4349-proxmox-inventory-dict-facts.yml
- 4421-zypper_package_version_handling_fix.yml
- 4422-warn-user-if-incorrect-SDK-version-is-installed.yaml
release_date: '2022-04-05'

View File

@@ -1,6 +1,6 @@
namespace: community
name: general
version: 3.8.3
version: 3.8.6
readme: README.md
authors:
- Ansible (https://github.com/ansible)

View File

@@ -20,6 +20,7 @@ DOCUMENTATION = '''
- List of connection information for the memcached DBs
default: ['127.0.0.1:11211']
type: list
elements: string
env:
- name: ANSIBLE_CACHE_PLUGIN_CONNECTION
ini:

View File

@@ -100,28 +100,21 @@ class CallbackModule(CallbackBase):
smtp = smtplib.SMTP(self.smtphost, port=self.smtpport)
b_sender = to_bytes(self.sender)
b_to = to_bytes(self.to)
b_cc = to_bytes(self.cc)
b_bcc = to_bytes(self.bcc)
b_subject = to_bytes(subject)
b_body = to_bytes(body)
b_content = b'From: %s\n' % b_sender
b_content += b'To: %s\n' % b_to
content = 'From: %s\n' % self.sender
content += 'To: %s\n' % self.to
if self.cc:
b_content += b'Cc: %s\n' % b_cc
b_content += b'Subject: %s\n\n' % b_subject
b_content += b_body
content += 'Cc: %s\n' % self.cc
content += 'Subject: %s\n\n' % subject.strip()
content += body
b_addresses = b_to.split(b',')
addresses = self.to.split(',')
if self.cc:
b_addresses += b_cc.split(b',')
addresses += self.cc.split(',')
if self.bcc:
b_addresses += b_bcc.split(b',')
addresses += self.bcc.split(',')
for b_address in b_addresses:
smtp.sendmail(b_sender, b_address, b_content)
for address in addresses:
smtp.sendmail(self.sender, address, to_bytes(content))
smtp.quit()

View File

@@ -70,6 +70,7 @@ import os
import json
from ansible.module_utils.six.moves.urllib.parse import urlencode
from ansible.module_utils.common.text.converters import to_bytes
from ansible.module_utils.urls import open_url
from ansible.plugins.callback import CallbackBase
@@ -143,7 +144,7 @@ class CallbackModule(CallbackBase):
body = {
'cmd': 'submitcheck',
'token': self.token,
'XMLDATA': bytes(xmldata)
'XMLDATA': to_bytes(xmldata)
}
try:

View File

@@ -21,11 +21,11 @@ DOCUMENTATION = '''
- In 2.8, this callback has been renamed from C(osx_say) into M(community.general.say).
'''
import distutils.spawn
import platform
import subprocess
import os
from ansible.module_utils.common.process import get_bin_path
from ansible.plugins.callback import CallbackBase
@@ -47,21 +47,24 @@ class CallbackModule(CallbackBase):
self.HAPPY_VOICE = None
self.LASER_VOICE = None
self.synthesizer = distutils.spawn.find_executable('say')
if not self.synthesizer:
self.synthesizer = distutils.spawn.find_executable('espeak')
if self.synthesizer:
try:
self.synthesizer = get_bin_path('say')
if platform.system() != 'Darwin':
# 'say' binary available, it might be GNUstep tool which doesn't support 'voice' parameter
self._display.warning("'say' executable found but system is '%s': ignoring voice parameter" % platform.system())
else:
self.FAILED_VOICE = 'Zarvox'
self.REGULAR_VOICE = 'Trinoids'
self.HAPPY_VOICE = 'Cellos'
self.LASER_VOICE = 'Princess'
except ValueError:
try:
self.synthesizer = get_bin_path('espeak')
self.FAILED_VOICE = 'klatt'
self.HAPPY_VOICE = 'f5'
self.LASER_VOICE = 'whisper'
elif platform.system() != 'Darwin':
# 'say' binary available, it might be GNUstep tool which doesn't support 'voice' parameter
self._display.warning("'say' executable found but system is '%s': ignoring voice parameter" % platform.system())
else:
self.FAILED_VOICE = 'Zarvox'
self.REGULAR_VOICE = 'Trinoids'
self.HAPPY_VOICE = 'Cellos'
self.LASER_VOICE = 'Princess'
except ValueError:
self.synthesizer = None
# plugin disable itself if say is not present
# ansible will not call any callback if disabled is set to True

View File

@@ -31,7 +31,6 @@ DOCUMENTATION = '''
- name: ansible_jail_user
'''
import distutils.spawn
import os
import os.path
import subprocess
@@ -39,6 +38,7 @@ import traceback
from ansible.errors import AnsibleError
from ansible.module_utils.six.moves import shlex_quote
from ansible.module_utils.common.process import get_bin_path
from ansible.module_utils.common.text.converters import to_bytes, to_native, to_text
from ansible.plugins.connection import ConnectionBase, BUFSIZE
from ansible.utils.display import Display
@@ -75,10 +75,10 @@ class Connection(ConnectionBase):
@staticmethod
def _search_executable(executable):
cmd = distutils.spawn.find_executable(executable)
if not cmd:
try:
return get_bin_path(executable)
except ValueError:
raise AnsibleError("%s command not found in PATH" % executable)
return cmd
def list_jails(self):
p = subprocess.Popen([self.jls_cmd, '-q', 'name'],

View File

@@ -43,10 +43,10 @@ DOCUMENTATION = '''
'''
import os
from distutils.spawn import find_executable
from subprocess import Popen, PIPE
from ansible.errors import AnsibleError, AnsibleConnectionFailure, AnsibleFileNotFound
from ansible.module_utils.common.process import get_bin_path
from ansible.module_utils.common.text.converters import to_bytes, to_text
from ansible.plugins.connection import ConnectionBase
@@ -62,9 +62,9 @@ class Connection(ConnectionBase):
super(Connection, self).__init__(play_context, new_stdin, *args, **kwargs)
self._host = self._play_context.remote_addr
self._lxc_cmd = find_executable("lxc")
if not self._lxc_cmd:
try:
self._lxc_cmd = get_bin_path("lxc")
except ValueError:
raise AnsibleError("lxc command not found in PATH")
if self._play_context.remote_user is not None and self._play_context.remote_user != 'root':

View File

@@ -26,7 +26,6 @@ DOCUMENTATION = '''
- name: ansible_zone_host
'''
import distutils.spawn
import os
import os.path
import subprocess
@@ -34,6 +33,7 @@ import traceback
from ansible.errors import AnsibleError
from ansible.module_utils.six.moves import shlex_quote
from ansible.module_utils.common.process import get_bin_path
from ansible.module_utils.common.text.converters import to_bytes
from ansible.plugins.connection import ConnectionBase, BUFSIZE
from ansible.utils.display import Display
@@ -64,10 +64,10 @@ class Connection(ConnectionBase):
@staticmethod
def _search_executable(executable):
cmd = distutils.spawn.find_executable(executable)
if not cmd:
try:
return get_bin_path(executable)
except ValueError:
raise AnsibleError("%s command not found in PATH" % executable)
return cmd
def list_zones(self):
process = subprocess.Popen([self.zoneadm_cmd, 'list', '-ip'],

View File

@@ -38,8 +38,10 @@ options:
version_added: 2.0.0
server_uri:
description:
- A URI to the LDAP server.
- The I(server_uri) parameter may be a comma- or whitespace-separated list of URIs containing only the schema, the host, and the port fields.
- The default value lets the underlying LDAP client library look for a UNIX domain socket in its default location.
- Note that when using multiple URIs you cannot determine to which URI your client gets connected.
- For URIs containing additional fields, particularly when using commas, behavior is undefined.
type: str
default: ldapi:///
start_tls:

View File

@@ -5,7 +5,7 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from distutils.version import LooseVersion
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
def version_sort(value, reverse=False):

View File

@@ -47,6 +47,7 @@ DOCUMENTATION = '''
group_by:
description: Keys to group hosts by
type: list
elements: string
default: [ 'mgmt_classes', 'owners', 'status' ]
group:
description: Group to place all hosts into
@@ -68,7 +69,6 @@ user: ansible-tester
password: secure
'''
from distutils.version import LooseVersion
import socket
from ansible.errors import AnsibleError

View File

@@ -35,7 +35,6 @@ DOCUMENTATION = '''
version_added: 1.0.0
type: str
required: true
default: https://gitlab.com
api_token:
description: GitLab token for logging in.
env:

View File

@@ -43,15 +43,18 @@ DOCUMENTATION = r'''
description: Populate inventory with instances in this region.
default: []
type: list
elements: string
tags:
description: Populate inventory only with instances which have at least one of the tags listed here.
default: []
type: list
elements: string
version_added: 2.0.0
types:
description: Populate inventory with instances with this type.
default: []
type: list
elements: string
strict:
version_added: 2.0.0
compose:

View File

@@ -27,6 +27,7 @@ DOCUMENTATION = '''
exclude:
description: list of addresses to exclude
type: list
elements: string
ports:
description: Enable/disable scanning for open ports
type: boolean

View File

@@ -28,6 +28,7 @@ DOCUMENTATION = r'''
hostnames:
description: List of preference about what to use as an hostname.
type: list
elements: string
default:
- public_ipv4
choices:
@@ -37,6 +38,7 @@ DOCUMENTATION = r'''
groups:
description: List of groups.
type: list
elements: string
choices:
- location
- offer

View File

@@ -114,17 +114,34 @@ groups:
mailservers: "'mail' in (proxmox_tags_parsed|list)"
compose:
ansible_port: 2222
# Using the inventory to allow ansible to connect via the first IP address of the VM / Container
# (Default is connection by name of QEMU/LXC guests)
# Note: my_inv_var demonstrates how to add a string variable to every host used by the inventory.
# my.proxmox.yml
plugin: community.general.proxmox
url: http://pve.domain.com:8006
user: ansible@pve
password: secure
validate_certs: false
want_facts: true
compose:
ansible_host: proxmox_ipconfig0.ip | default(proxmox_net0.ip) | ipaddr('address')
my_inv_var_1: "'my_var1_value'"
my_inv_var_2: >
"my_var_2_value"
'''
import re
from ansible.module_utils.common._collections_compat import MutableMapping
from distutils.version import LooseVersion
from ansible.errors import AnsibleError
from ansible.plugins.inventory import BaseInventoryPlugin, Constructable, Cacheable
from ansible.module_utils.six.moves.urllib.parse import urlencode
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
# 3rd party imports
try:
import requests
@@ -290,7 +307,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
self.inventory.set_variable(name, vmtype_key, vmtype)
plaintext_configs = [
'tags',
'description',
]
for config in ret:
@@ -316,11 +333,11 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
if agent_iface_value:
self.inventory.set_variable(name, agent_iface_key, agent_iface_value)
if not (isinstance(value, int) or ',' not in value):
if config not in plaintext_configs and not isinstance(value, int) and all("=" in v for v in value.split(",")):
# split off strings with commas to a dict
# skip over any keys that cannot be processed
try:
value = dict(key.split("=") for key in value.split(","))
value = dict(key.split("=", 1) for key in value.split(","))
except Exception:
continue

View File

@@ -23,6 +23,7 @@ DOCUMENTATION = r'''
regions:
description: Filter results on a specific Scaleway region.
type: list
elements: string
default:
- ams1
- par1
@@ -31,6 +32,7 @@ DOCUMENTATION = r'''
tags:
description: Filter results on a specific tag.
type: list
elements: string
oauth_token:
description:
- Scaleway OAuth token.
@@ -45,6 +47,7 @@ DOCUMENTATION = r'''
hostnames:
description: List of preference about what to use as an hostname.
type: list
elements: string
default:
- public_ipv4
choices:

View File

@@ -20,6 +20,7 @@ DOCUMENTATION = '''
_raw:
description: List of key(s) to retrieve.
type: list
elements: string
recurse:
type: boolean
description: If true, will retrieve all the values that have the given key as prefix.

View File

@@ -17,11 +17,11 @@ DOCUMENTATION = '''
_terms:
description: term or list of terms to lookup in the credit store
type: list
required: True
elements: string
required: true
table:
description: name of the credstash table to query
default: 'credential-store'
required: True
version:
description: Credstash version
region:

View File

@@ -18,6 +18,7 @@ DOCUMENTATION = '''
description: domain or list of domains to query TXT records from
required: True
type: list
elements: string
'''
EXAMPLES = """

View File

@@ -105,11 +105,15 @@ display = Display()
class LookupModule(LookupBase):
@staticmethod
def Client(vault_parameters):
return SecretsVault(**vault_parameters)
try:
vault = SecretsVault(**vault_parameters)
return vault
except TypeError:
raise AnsibleError("python-dsv-sdk==0.0.1 must be installed to use this plugin")
def run(self, terms, variables, **kwargs):
if sdk_is_missing:
raise AnsibleError("python-dsv-sdk must be installed to use this plugin")
raise AnsibleError("python-dsv-sdk==0.0.1 must be installed to use this plugin")
self.set_options(var_options=variables, direct=kwargs)

View File

@@ -23,7 +23,7 @@ DOCUMENTATION = '''
EXAMPLES = """
- name: "'unnest' all elements into single list"
ansible.builtin.debug:
msg: "all in one list {{lookup('community.general.flattened', [1,2,3,[5,6]], [a,b,c], [[5,6,1,3], [34,a,b,c]])}}"
msg: "all in one list {{lookup('community.general.flattened', [1,2,3,[5,6]], ['a','b','c'], [[5,6,1,3], [34,'a','b','c']])}}"
"""
RETURN = """

View File

@@ -48,7 +48,6 @@ options:
- The CIDR of the network to retrieve the next network from next available network within the
specified container. Also, Requested CIDR must be specified and greater than the parent CIDR.
required: True
default: 24
num:
description: The number of network addresses to return from network-container
required: false

View File

@@ -141,9 +141,9 @@ import time
import yaml
from distutils import util
from ansible.errors import AnsibleError, AnsibleAssertionError
from ansible.module_utils.common.text.converters import to_bytes, to_native, to_text
from ansible.module_utils.parsing.convert_bool import boolean
from ansible.utils.display import Display
from ansible.utils.encrypt import random_password
from ansible.plugins.lookup import LookupBase
@@ -154,6 +154,7 @@ display = Display()
# backhacked check_output with input for python 2.7
# http://stackoverflow.com/questions/10103551/passing-data-to-subprocess-check-output
# note: contains special logic for calling 'pass', so not a drop-in replacement for check_output
def check_output2(*popenargs, **kwargs):
if 'stdout' in kwargs:
raise ValueError('stdout argument not allowed, it will be overridden.')
@@ -175,9 +176,10 @@ def check_output2(*popenargs, **kwargs):
process.wait()
raise
retcode = process.poll()
if retcode != 0 or \
b'encryption failed: Unusable public key' in b_out or \
b'encryption failed: Unusable public key' in b_err:
if retcode == 0 and (b'encryption failed: Unusable public key' in b_out or
b'encryption failed: Unusable public key' in b_err):
retcode = 78 # os.EX_CONFIG
if retcode != 0:
cmd = kwargs.get("args")
if cmd is None:
cmd = popenargs[0]
@@ -211,7 +213,7 @@ class LookupModule(LookupBase):
try:
for key in ['create', 'returnall', 'overwrite', 'backup', 'nosymbols']:
if not isinstance(self.paramvals[key], bool):
self.paramvals[key] = util.strtobool(self.paramvals[key])
self.paramvals[key] = boolean(self.paramvals[key])
except (ValueError, AssertionError) as e:
raise AnsibleError(e)
if self.paramvals['missing'] not in ['error', 'warn', 'create', 'empty']:
@@ -227,13 +229,13 @@ class LookupModule(LookupBase):
# Collect pass environment variables from the plugin's parameters.
self.env = os.environ.copy()
self.env['LANGUAGE'] = 'C' # make sure to get errors in English as required by check_output2
# Set PASSWORD_STORE_DIR if directory is set
if self.paramvals['directory']:
if os.path.isdir(self.paramvals['directory']):
self.env['PASSWORD_STORE_DIR'] = self.paramvals['directory']
else:
raise AnsibleError('Passwordstore directory \'{0}\' does not exist'.format(self.paramvals['directory']))
# Set PASSWORD_STORE_DIR
if os.path.isdir(self.paramvals['directory']):
self.env['PASSWORD_STORE_DIR'] = self.paramvals['directory']
else:
raise AnsibleError('Passwordstore directory \'{0}\' does not exist'.format(self.paramvals['directory']))
# Set PASSWORD_STORE_UMASK if umask is set
if 'umask' in self.paramvals:
@@ -261,19 +263,20 @@ class LookupModule(LookupBase):
if ':' in line:
name, value = line.split(':', 1)
self.passdict[name.strip()] = value.strip()
if os.path.isfile(os.path.join(self.paramvals['directory'], self.passname + ".gpg")):
# Only accept password as found, if there a .gpg file for it (might be a tree node otherwise)
return True
except (subprocess.CalledProcessError) as e:
if e.returncode != 0 and 'not in the password store' in e.output:
# if pass returns 1 and return string contains 'is not in the password store.'
# We need to determine if this is valid or Error.
if self.paramvals['missing'] == 'error':
raise AnsibleError('passwordstore: passname {0} not found and missing=error is set'.format(self.passname))
else:
if self.paramvals['missing'] == 'warn':
display.warning('passwordstore: passname {0} not found'.format(self.passname))
return False
else:
# 'not in password store' is the expected error if a password wasn't found
if 'not in the password store' not in e.output:
raise AnsibleError(e)
return True
if self.paramvals['missing'] == 'error':
raise AnsibleError('passwordstore: passname {0} not found and missing=error is set'.format(self.passname))
elif self.paramvals['missing'] == 'warn':
display.warning('passwordstore: passname {0} not found'.format(self.passname))
return False
def get_newpass(self):
if self.paramvals['nosymbols']:
@@ -329,7 +332,9 @@ class LookupModule(LookupBase):
result = []
self.paramvals = {
'subkey': 'password',
'directory': variables.get('passwordstore'),
'directory': variables.get('passwordstore', os.environ.get(
'PASSWORD_STORE_DIR',
os.path.expanduser('~/.password-store'))),
'create': False,
'returnall': False,
'overwrite': False,

View File

@@ -14,6 +14,10 @@ description:
- Uses the Thycotic Secret Server Python SDK to get Secrets from Secret
Server using token authentication with I(username) and I(password) on
the REST API at I(base_url).
- When using self-signed certificates the environment variable
C(REQUESTS_CA_BUNDLE) can be set to a file containing the trusted certificates
(in C(.pem) format).
- For example, C(export REQUESTS_CA_BUNDLE='/etc/ssl/certs/ca-bundle.trust.crt').
requirements:
- python-tss-sdk - https://pypi.org/project/python-tss-sdk/
options:

View File

@@ -0,0 +1,343 @@
# Vendored copy of distutils/version.py from CPython 3.9.5
#
# Implements multiple version numbering conventions for the
# Python Module Distribution Utilities.
#
# PSF License (see licenses/PSF-license.txt or https://opensource.org/licenses/Python-2.0)
#
"""Provides classes to represent module version numbers (one class for
each style of version numbering). There are currently two such classes
implemented: StrictVersion and LooseVersion.
Every version number class implements the following interface:
* the 'parse' method takes a string and parses it to some internal
representation; if the string is an invalid version number,
'parse' raises a ValueError exception
* the class constructor takes an optional string argument which,
if supplied, is passed to 'parse'
* __str__ reconstructs the string that was passed to 'parse' (or
an equivalent string -- ie. one that will generate an equivalent
version number instance)
* __repr__ generates Python code to recreate the version number instance
* _cmp compares the current instance with either another instance
of the same class or a string (which will be parsed to an instance
of the same class, thus must follow the same rules)
"""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import re
try:
RE_FLAGS = re.VERBOSE | re.ASCII
except AttributeError:
RE_FLAGS = re.VERBOSE
class Version:
"""Abstract base class for version numbering classes. Just provides
constructor (__init__) and reproducer (__repr__), because those
seem to be the same for all version numbering classes; and route
rich comparisons to _cmp.
"""
def __init__(self, vstring=None):
if vstring:
self.parse(vstring)
def __repr__(self):
return "%s ('%s')" % (self.__class__.__name__, str(self))
def __eq__(self, other):
c = self._cmp(other)
if c is NotImplemented:
return c
return c == 0
def __lt__(self, other):
c = self._cmp(other)
if c is NotImplemented:
return c
return c < 0
def __le__(self, other):
c = self._cmp(other)
if c is NotImplemented:
return c
return c <= 0
def __gt__(self, other):
c = self._cmp(other)
if c is NotImplemented:
return c
return c > 0
def __ge__(self, other):
c = self._cmp(other)
if c is NotImplemented:
return c
return c >= 0
# Interface for version-number classes -- must be implemented
# by the following classes (the concrete ones -- Version should
# be treated as an abstract class).
# __init__ (string) - create and take same action as 'parse'
# (string parameter is optional)
# parse (string) - convert a string representation to whatever
# internal representation is appropriate for
# this style of version numbering
# __str__ (self) - convert back to a string; should be very similar
# (if not identical to) the string supplied to parse
# __repr__ (self) - generate Python code to recreate
# the instance
# _cmp (self, other) - compare two version numbers ('other' may
# be an unparsed version string, or another
# instance of your version class)
class StrictVersion(Version):
"""Version numbering for anal retentives and software idealists.
Implements the standard interface for version number classes as
described above. A version number consists of two or three
dot-separated numeric components, with an optional "pre-release" tag
on the end. The pre-release tag consists of the letter 'a' or 'b'
followed by a number. If the numeric components of two version
numbers are equal, then one with a pre-release tag will always
be deemed earlier (lesser) than one without.
The following are valid version numbers (shown in the order that
would be obtained by sorting according to the supplied cmp function):
0.4 0.4.0 (these two are equivalent)
0.4.1
0.5a1
0.5b3
0.5
0.9.6
1.0
1.0.4a3
1.0.4b1
1.0.4
The following are examples of invalid version numbers:
1
2.7.2.2
1.3.a4
1.3pl1
1.3c4
The rationale for this version numbering system will be explained
in the distutils documentation.
"""
version_re = re.compile(r'^(\d+) \. (\d+) (\. (\d+))? ([ab](\d+))?$',
RE_FLAGS)
def parse(self, vstring):
match = self.version_re.match(vstring)
if not match:
raise ValueError("invalid version number '%s'" % vstring)
(major, minor, patch, prerelease, prerelease_num) = \
match.group(1, 2, 4, 5, 6)
if patch:
self.version = tuple(map(int, [major, minor, patch]))
else:
self.version = tuple(map(int, [major, minor])) + (0,)
if prerelease:
self.prerelease = (prerelease[0], int(prerelease_num))
else:
self.prerelease = None
def __str__(self):
if self.version[2] == 0:
vstring = '.'.join(map(str, self.version[0:2]))
else:
vstring = '.'.join(map(str, self.version))
if self.prerelease:
vstring = vstring + self.prerelease[0] + str(self.prerelease[1])
return vstring
def _cmp(self, other):
if isinstance(other, str):
other = StrictVersion(other)
elif not isinstance(other, StrictVersion):
return NotImplemented
if self.version != other.version:
# numeric versions don't match
# prerelease stuff doesn't matter
if self.version < other.version:
return -1
else:
return 1
# have to compare prerelease
# case 1: neither has prerelease; they're equal
# case 2: self has prerelease, other doesn't; other is greater
# case 3: self doesn't have prerelease, other does: self is greater
# case 4: both have prerelease: must compare them!
if (not self.prerelease and not other.prerelease):
return 0
elif (self.prerelease and not other.prerelease):
return -1
elif (not self.prerelease and other.prerelease):
return 1
elif (self.prerelease and other.prerelease):
if self.prerelease == other.prerelease:
return 0
elif self.prerelease < other.prerelease:
return -1
else:
return 1
else:
raise AssertionError("never get here")
# end class StrictVersion
# The rules according to Greg Stein:
# 1) a version number has 1 or more numbers separated by a period or by
# sequences of letters. If only periods, then these are compared
# left-to-right to determine an ordering.
# 2) sequences of letters are part of the tuple for comparison and are
# compared lexicographically
# 3) recognize the numeric components may have leading zeroes
#
# The LooseVersion class below implements these rules: a version number
# string is split up into a tuple of integer and string components, and
# comparison is a simple tuple comparison. This means that version
# numbers behave in a predictable and obvious way, but a way that might
# not necessarily be how people *want* version numbers to behave. There
# wouldn't be a problem if people could stick to purely numeric version
# numbers: just split on period and compare the numbers as tuples.
# However, people insist on putting letters into their version numbers;
# the most common purpose seems to be:
# - indicating a "pre-release" version
# ('alpha', 'beta', 'a', 'b', 'pre', 'p')
# - indicating a post-release patch ('p', 'pl', 'patch')
# but of course this can't cover all version number schemes, and there's
# no way to know what a programmer means without asking him.
#
# The problem is what to do with letters (and other non-numeric
# characters) in a version number. The current implementation does the
# obvious and predictable thing: keep them as strings and compare
# lexically within a tuple comparison. This has the desired effect if
# an appended letter sequence implies something "post-release":
# eg. "0.99" < "0.99pl14" < "1.0", and "5.001" < "5.001m" < "5.002".
#
# However, if letters in a version number imply a pre-release version,
# the "obvious" thing isn't correct. Eg. you would expect that
# "1.5.1" < "1.5.2a2" < "1.5.2", but under the tuple/lexical comparison
# implemented here, this just isn't so.
#
# Two possible solutions come to mind. The first is to tie the
# comparison algorithm to a particular set of semantic rules, as has
# been done in the StrictVersion class above. This works great as long
# as everyone can go along with bondage and discipline. Hopefully a
# (large) subset of Python module programmers will agree that the
# particular flavour of bondage and discipline provided by StrictVersion
# provides enough benefit to be worth using, and will submit their
# version numbering scheme to its domination. The free-thinking
# anarchists in the lot will never give in, though, and something needs
# to be done to accommodate them.
#
# Perhaps a "moderately strict" version class could be implemented that
# lets almost anything slide (syntactically), and makes some heuristic
# assumptions about non-digits in version number strings. This could
# sink into special-case-hell, though; if I was as talented and
# idiosyncratic as Larry Wall, I'd go ahead and implement a class that
# somehow knows that "1.2.1" < "1.2.2a2" < "1.2.2" < "1.2.2pl3", and is
# just as happy dealing with things like "2g6" and "1.13++". I don't
# think I'm smart enough to do it right though.
#
# In any case, I've coded the test suite for this module (see
# ../test/test_version.py) specifically to fail on things like comparing
# "1.2a2" and "1.2". That's not because the *code* is doing anything
# wrong, it's because the simple, obvious design doesn't match my
# complicated, hairy expectations for real-world version numbers. It
# would be a snap to fix the test suite to say, "Yep, LooseVersion does
# the Right Thing" (ie. the code matches the conception). But I'd rather
# have a conception that matches common notions about version numbers.
class LooseVersion(Version):
"""Version numbering for anarchists and software realists.
Implements the standard interface for version number classes as
described above. A version number consists of a series of numbers,
separated by either periods or strings of letters. When comparing
version numbers, the numeric components will be compared
numerically, and the alphabetic components lexically. The following
are all valid version numbers, in no particular order:
1.5.1
1.5.2b2
161
3.10a
8.02
3.4j
1996.07.12
3.2.pl0
3.1.1.6
2g6
11g
0.960923
2.2beta29
1.13++
5.5.kw
2.0b1pl0
In fact, there is no such thing as an invalid version number under
this scheme; the rules for comparison are simple and predictable,
but may not always give the results you want (for some definition
of "want").
"""
component_re = re.compile(r'(\d+ | [a-z]+ | \.)', re.VERBOSE)
def __init__(self, vstring=None):
if vstring:
self.parse(vstring)
def parse(self, vstring):
# I've given up on thinking I can reconstruct the version string
# from the parsed tuple -- so I just store the string here for
# use by __str__
self.vstring = vstring
components = [x for x in self.component_re.split(vstring) if x and x != '.']
for i, obj in enumerate(components):
try:
components[i] = int(obj)
except ValueError:
pass
self.version = components
def __str__(self):
return self.vstring
def __repr__(self):
return "LooseVersion ('%s')" % str(self)
def _cmp(self, other):
if isinstance(other, str):
other = LooseVersion(other)
elif not isinstance(other, LooseVersion):
return NotImplemented
if self.version == other.version:
return 0
if self.version < other.version:
return -1
if self.version > other.version:
return 1
# end class LooseVersion

View File

@@ -8,12 +8,13 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
from distutils.version import StrictVersion
from ansible.module_utils.basic import missing_required_lib
from ansible.module_utils.urls import fetch_url
from ansible.module_utils.common.text.converters import to_native
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
try:
from urllib import quote_plus # Python 2.X
except ImportError:
@@ -90,7 +91,7 @@ def gitlabAuthentication(module):
# python-gitlab library remove support for username/password authentication since 1.13.0
# Changelog : https://github.com/python-gitlab/python-gitlab/releases/tag/v1.13.0
# This condition allow to still support older version of the python-gitlab library
if StrictVersion(gitlab.__version__) < StrictVersion("1.13.0"):
if LooseVersion(gitlab.__version__) < LooseVersion("1.13.0"):
gitlab_instance = gitlab.Gitlab(url=gitlab_url, ssl_verify=validate_certs, email=gitlab_user, password=gitlab_password,
private_token=gitlab_token, api_version=4)
else:

View File

@@ -9,7 +9,8 @@ __metaclass__ = type
import traceback
from ansible.module_utils.basic import missing_required_lib
from distutils.version import LooseVersion
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
REQUESTS_IMP_ERR = None
try:

View File

@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
# Copyright: (c) 2021, Felix Fontein <felix@fontein.de>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""Provide version object to compare version numbers."""
from __future__ import absolute_import, division, print_function
__metaclass__ = type
# Once we drop support for Ansible 2.9, ansible-base 2.10, and ansible-core 2.11, we can
# remove the _version.py file, and replace the following import by
#
# from ansible.module_utils.compat.version import LooseVersion
from ._version import LooseVersion

View File

@@ -120,7 +120,7 @@ __version__ = '${version}'
import os
import traceback
from distutils.version import LooseVersion
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
REQUESTS_IMP_ERR = None
try:

View File

@@ -161,7 +161,8 @@ __version__ = '${version}'
import json
import os
import traceback
from distutils.version import LooseVersion
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
REQUESTS_IMP_ERR = None
try:

View File

@@ -42,7 +42,7 @@ options:
description:
- Whether to wait for the tasks to finish before returning.
type: str
default: True
default: 'True'
required: False
requirements:
- python = 2.7
@@ -89,7 +89,8 @@ __version__ = '${version}'
import os
import traceback
from distutils.version import LooseVersion
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
REQUESTS_IMP_ERR = None
try:
@@ -132,8 +133,7 @@ class ClcBlueprintPackage:
self.module.fail_json(msg=missing_required_lib('clc-sdk'), exception=CLC_IMP_ERR)
if not REQUESTS_FOUND:
self.module.fail_json(msg=missing_required_lib('requests'), exception=REQUESTS_IMP_ERR)
if requests.__version__ and LooseVersion(
requests.__version__) < LooseVersion('2.5.0'):
if requests.__version__ and LooseVersion(requests.__version__) < LooseVersion('2.5.0'):
self.module.fail_json(
msg='requests library version should be >= 2.5.0')

View File

@@ -66,8 +66,8 @@ options:
description:
- Whether the firewall policy is enabled or disabled
type: str
choices: [True, False]
default: True
choices: ['True', 'False']
default: 'True'
requirements:
- python = 2.7
- requests >= 2.5.0
@@ -162,7 +162,8 @@ import os
import traceback
from ansible.module_utils.six.moves.urllib.parse import urlparse
from time import sleep
from distutils.version import LooseVersion
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
REQUESTS_IMP_ERR = None
try:
@@ -203,8 +204,7 @@ class ClcFirewallPolicy:
self.module.fail_json(msg=missing_required_lib('clc-sdk'), exception=CLC_IMP_ERR)
if not REQUESTS_FOUND:
self.module.fail_json(msg=missing_required_lib('requests'), exception=REQUESTS_IMP_ERR)
if requests.__version__ and LooseVersion(
requests.__version__) < LooseVersion('2.5.0'):
if requests.__version__ and LooseVersion(requests.__version__) < LooseVersion('2.5.0'):
self.module.fail_json(
msg='requests library version should be >= 2.5.0')

View File

@@ -207,7 +207,8 @@ __version__ = '${version}'
import os
import traceback
from distutils.version import LooseVersion
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
REQUESTS_IMP_ERR = None
try:

View File

@@ -48,7 +48,7 @@ options:
description:
- Port to configure on the public-facing side of the load balancer pool
type: str
choices: [80, 443]
choices: ['80', '443']
nodes:
description:
- A list of nodes that needs to be added to the load balancer pool
@@ -210,7 +210,8 @@ import json
import os
import traceback
from time import sleep
from distutils.version import LooseVersion
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
REQUESTS_IMP_ERR = None
try:
@@ -255,8 +256,7 @@ class ClcLoadBalancer:
self.module.fail_json(msg=missing_required_lib('clc-sdk'), exception=CLC_IMP_ERR)
if not REQUESTS_FOUND:
self.module.fail_json(msg=missing_required_lib('requests'), exception=REQUESTS_IMP_ERR)
if requests.__version__ and LooseVersion(
requests.__version__) < LooseVersion('2.5.0'):
if requests.__version__ and LooseVersion(requests.__version__) < LooseVersion('2.5.0'):
self.module.fail_json(
msg='requests library version should be >= 2.5.0')

View File

@@ -311,7 +311,8 @@ __version__ = '${version}'
import json
import os
import traceback
from distutils.version import LooseVersion
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
REQUESTS_IMP_ERR = None
try:
@@ -355,8 +356,7 @@ class ClcModifyServer:
self.module.fail_json(msg=missing_required_lib('clc-sdk'), exception=CLC_IMP_ERR)
if not REQUESTS_FOUND:
self.module.fail_json(msg=missing_required_lib('requests'), exception=REQUESTS_IMP_ERR)
if requests.__version__ and LooseVersion(
requests.__version__) < LooseVersion('2.5.0'):
if requests.__version__ and LooseVersion(requests.__version__) < LooseVersion('2.5.0'):
self.module.fail_json(
msg='requests library version should be >= 2.5.0')

View File

@@ -117,7 +117,8 @@ __version__ = '${version}'
import os
import traceback
from distutils.version import LooseVersion
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
REQUESTS_IMP_ERR = None
try:

View File

@@ -433,7 +433,8 @@ import json
import os
import time
import traceback
from distutils.version import LooseVersion
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
REQUESTS_IMP_ERR = None
try:
@@ -478,8 +479,7 @@ class ClcServer:
self.module.fail_json(msg=missing_required_lib('clc-sdk'), exception=CLC_IMP_ERR)
if not REQUESTS_FOUND:
self.module.fail_json(msg=missing_required_lib('requests'), exception=REQUESTS_IMP_ERR)
if requests.__version__ and LooseVersion(
requests.__version__) < LooseVersion('2.5.0'):
if requests.__version__ and LooseVersion(requests.__version__) < LooseVersion('2.5.0'):
self.module.fail_json(
msg='requests library version should be >= 2.5.0')

View File

@@ -36,7 +36,7 @@ options:
wait:
description:
- Whether to wait for the provisioning tasks to finish before returning.
default: True
default: 'True'
required: False
type: str
requirements:
@@ -101,7 +101,8 @@ __version__ = '${version}'
import os
import traceback
from distutils.version import LooseVersion
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
REQUESTS_IMP_ERR = None
try:
@@ -145,8 +146,7 @@ class ClcSnapshot:
self.module.fail_json(msg=missing_required_lib('clc-sdk'), exception=CLC_IMP_ERR)
if not REQUESTS_FOUND:
self.module.fail_json(msg=missing_required_lib('requests'), exception=REQUESTS_IMP_ERR)
if requests.__version__ and LooseVersion(
requests.__version__) < LooseVersion('2.5.0'):
if requests.__version__ and LooseVersion(requests.__version__) < LooseVersion('2.5.0'):
self.module.fail_json(
msg='requests library version should be >= 2.5.0')

View File

@@ -51,7 +51,6 @@ options:
group.s
type: str
required: false
default: 0
vpc_id:
description:
- Specifies the resource ID of the VPC to which the security group

View File

@@ -363,7 +363,8 @@ EXAMPLES = r'''
import time
import traceback
from distutils.version import LooseVersion
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
try:
from proxmoxer import ProxmoxAPI

View File

@@ -761,9 +761,10 @@ msg:
import re
import time
import traceback
from distutils.version import LooseVersion
from ansible.module_utils.six.moves.urllib.parse import quote
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
try:
from proxmoxer import ProxmoxAPI
HAS_PROXMOXER = True

View File

@@ -230,11 +230,12 @@ command:
import os
import json
import tempfile
from distutils.version import LooseVersion
from ansible.module_utils.six.moves import shlex_quote
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
module = None

View File

@@ -97,7 +97,7 @@ EXAMPLES = '''
register: my_volume
'''
from distutils.version import LooseVersion
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
try:
import pyrax

View File

@@ -42,7 +42,7 @@ options:
description:
- version of database (MySQL supports 5.1 and 5.6, MariaDB supports 10, Percona supports 5.6)
- "The available choices are: C(5.1), C(5.6) and C(10)."
default: 5.6
default: '5.6'
aliases: ['version']
state:
type: str

View File

@@ -75,7 +75,7 @@ def patch_user_data(compute_api, server_id, key, value):
compute_api.module.debug("Starting patching user_data attributes")
path = "servers/%s/user_data/%s" % (server_id, key)
response = compute_api.patch(path=path, data=value, headers={"Content-type": "text/plain"})
response = compute_api.patch(path=path, data=value, headers={"Content-Type": "text/plain"})
if not response.ok:
msg = 'Error during user_data patching: %s %s' % (response.status_code, response.body)
compute_api.module.fail_json(msg=msg)

View File

@@ -117,9 +117,10 @@ state:
'''
import os
from distutils.version import LooseVersion
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
PACKAGE_STATE_MAP = dict(
present="--install",

View File

@@ -25,7 +25,7 @@ options:
port:
description:
Database port to connect to.
default: 5433
default: '5433'
type: str
db:
description:

View File

@@ -44,7 +44,7 @@ options:
port:
description:
- Vertica cluster port to connect to.
default: 5433
default: '5433'
type: str
login_user:
description:

View File

@@ -58,7 +58,7 @@ options:
port:
description:
- Vertica cluster port to connect to.
default: 5433
default: '5433'
type: str
login_user:
description:

View File

@@ -70,7 +70,7 @@ options:
port:
description:
- Vertica cluster port to connect to.
default: 5433
default: '5433'
type: str
login_user:
description:

View File

@@ -83,7 +83,7 @@ options:
- Whether or not the file to create should be a sparse file.
- This option is effective only on newly created files, or when growing a
file, only for the bytes to append.
- This option is not supported on OpenBSD, Solaris and AIX.
- This option is not supported on OSes or filesystems not supporting sparse files.
- I(force=true) and I(sparse=true) are mutually exclusive.
type: bool
default: false
@@ -129,6 +129,10 @@ seealso:
- name: dd(1) manpage for NetBSD
description: Manual page of the NetBSD's dd implementation.
link: https://man.netbsd.org/dd.1
- name: busybox(1) manpage for Linux
description: Manual page of the GNU/Linux's busybox, that provides its own dd implementation.
link: https://www.unix.com/man-page/linux/1/busybox
'''
EXAMPLES = r'''
@@ -377,12 +381,10 @@ def complete_dd_cmdline(args, dd_cmd):
return list()
bs = args['size_spec']['blocksize']
conv = list()
# For sparse files (create, truncate, grow): write count=0 block.
if args['sparse']:
seek = args['size_spec']['blocks']
conv += ['sparse']
elif args['force'] or not os.path.exists(args['path']): # Create file
seek = 0
elif args['size_diff'] < 0: # Truncate file
@@ -394,8 +396,6 @@ def complete_dd_cmdline(args, dd_cmd):
count = args['size_spec']['blocks'] - seek
dd_cmd += ['bs=%s' % str(bs), 'seek=%s' % str(seek), 'count=%s' % str(count)]
if conv:
dd_cmd += ['conv=%s' % ','.join(conv)]
return dd_cmd

View File

@@ -367,9 +367,10 @@ def do_ini(module, filename, section=None, option=None, values=None,
section_lines = new_section_lines
else:
# drop the entire section
section_lines = []
msg = 'section removed'
changed = True
if section_lines:
section_lines = []
msg = 'section removed'
changed = True
# reassemble the ini_lines after manipulation
ini_lines = before + section_lines + after

View File

@@ -356,9 +356,10 @@ import os
import re
import traceback
from distutils.version import LooseVersion
from io import BytesIO
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
LXML_IMP_ERR = None
try:
from lxml import etree, objectify

View File

@@ -74,11 +74,12 @@ subca:
type: dict
'''
from distutils.version import LooseVersion
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.general.plugins.module_utils.ipa import IPAClient, ipa_argument_spec
from ansible.module_utils.common.text.converters import to_native
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
class SubCAIPAClient(IPAClient):
def __init__(self, module, host, port, protocol):

View File

@@ -103,7 +103,7 @@ author:
EXAMPLES = '''
- name: Map a client role to a group, authentication with credentials
community.general.keycloak_client_rolemappings:
community.general.keycloak_client_rolemapping:
realm: MyCustomRealm
auth_client_id: admin-cli
auth_keycloak_url: https://auth.example.com/auth
@@ -121,7 +121,7 @@ EXAMPLES = '''
delegate_to: localhost
- name: Map a client role to a group, authentication with token
community.general.keycloak_client_rolemappings:
community.general.keycloak_client_rolemapping:
realm: MyCustomRealm
auth_client_id: admin-cli
auth_keycloak_url: https://auth.example.com/auth
@@ -137,7 +137,7 @@ EXAMPLES = '''
delegate_to: localhost
- name: Unmap client role from a group
community.general.keycloak_client_rolemappings:
community.general.keycloak_client_rolemapping:
realm: MyCustomRealm
auth_client_id: admin-cli
auth_keycloak_url: https://auth.example.com/auth

View File

@@ -828,7 +828,7 @@ def main():
before_comp = dict()
# if user federation exists, get associated mappers
if cid is not None:
if cid is not None and before_comp:
before_comp['mappers'] = sorted(kc.get_components(urlencode(dict(parent=cid)), realm), key=lambda x: x.get('name'))
# build a changeset
@@ -904,12 +904,23 @@ def main():
after_comp = kc.create_component(updated_comp, realm)
for mapper in updated_mappers:
if mapper.get('id') is not None:
kc.update_component(mapper, realm)
found = kc.get_components(urlencode(dict(parent=cid, name=mapper['name'])), realm)
if len(found) > 1:
module.fail_json(msg='Found multiple mappers with name `{name}`. Cannot continue.'.format(name=mapper['name']))
if len(found) == 1:
old_mapper = found[0]
else:
if mapper.get('parentId') is None:
mapper['parentId'] = after_comp['id']
mapper = kc.create_component(mapper, realm)
old_mapper = {}
new_mapper = old_mapper.copy()
new_mapper.update(mapper)
if new_mapper.get('id') is not None:
kc.update_component(new_mapper, realm)
else:
if new_mapper.get('parentId') is None:
new_mapper['parentId'] = after_comp['id']
mapper = kc.create_component(new_mapper, realm)
after_comp['mappers'] = updated_mappers
result['end_state'] = sanitize(after_comp)

View File

@@ -294,7 +294,7 @@ class OnePasswordInfo(object):
except AnsibleModuleError as e:
module.fail_json(msg="Failed to perform initial sign in to 1Password: %s" % to_native(e))
else:
module.fail_json(msg="Unable to perform an initial sign in to 1Password. Please run '%s sigin' "
module.fail_json(msg="Unable to perform an initial sign in to 1Password. Please run '%s signin' "
"or define credentials in 'auto_login'. See the module documentation for details." % self.cli_path)
def get_token(self):

View File

@@ -143,7 +143,8 @@ annotation:
import json
import time
import traceback
from distutils.version import LooseVersion
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
REQUESTS_IMP_ERR = None
try:

View File

@@ -84,7 +84,6 @@ options:
description:
- Dictionary of scopes to silence, with timestamps or None.
- Each scope will be muted until the given POSIX timestamp or forever if the value is None.
default: ""
notify_no_data:
description:
- Whether this monitor will notify when data stops reporting.

View File

@@ -146,9 +146,10 @@ EXAMPLES = '''
RETURN = r"""# """
import traceback
from distutils.version import LooseVersion
import re
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
class DNSimpleV1():
"""class which uses dnsimple-python < 2"""

View File

@@ -77,8 +77,8 @@ options:
description:
- Network family defined by Infinity, e.g. IPv4, IPv6 and Dual stack
type: str
choices: [ 4, 6, dual ]
default: 4
choices: [ '4', '6', dual ]
default: '4'
'''
EXAMPLES = r'''

View File

@@ -124,7 +124,8 @@ import os
import ssl
import traceback
import platform
from distutils.version import LooseVersion
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
HAS_PAHOMQTT = True
PAHOMQTT_IMP_ERR = None
@@ -207,7 +208,7 @@ def main():
if tls_version:
tls_version = tls_map.get(tls_version, ssl.PROTOCOL_SSLv23)
else:
if LooseVersion(platform.python_version()) <= "3.5.2":
if LooseVersion(platform.python_version()) <= LooseVersion("3.5.2"):
# Specifying `None` on later versions of python seems sufficient to
# instruct python to autonegotiate the SSL/TLS connection. On versions
# 3.5.2 and lower though we need to specify the version.

View File

@@ -124,7 +124,7 @@ EXAMPLES = r'''
import os
import traceback
from distutils.version import LooseVersion
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
SENDGRID_IMP_ERR = None
try:

View File

@@ -346,7 +346,7 @@ def build_payload_for_slack(text, channel, thread_id, username, icon_url, icon_e
def get_slack_message(module, token, channel, ts):
headers = {
'Content-Type': 'application/json',
'Content-Type': 'application/json; charset=UTF-8',
'Accept': 'application/json',
'Authorization': 'Bearer ' + token
}
@@ -383,7 +383,7 @@ def do_notify_slack(module, domain, token, payload):
slack_uri = OLD_SLACK_INCOMING_WEBHOOK % (domain, token)
headers = {
'Content-Type': 'application/json',
'Content-Type': 'application/json; charset=UTF-8',
'Accept': 'application/json',
}
if use_webapi:

View File

@@ -163,7 +163,7 @@ from ansible.module_utils.basic import AnsibleModule
class Yarn(object):
DEFAULT_GLOBAL_INSTALLATION_PATH = '~/.config/yarn/global'
DEFAULT_GLOBAL_INSTALLATION_PATH = os.path.expanduser('~/.config/yarn/global')
def __init__(self, module, **kwargs):
self.module = module
@@ -241,16 +241,19 @@ class Yarn(object):
if error:
self.module.fail_json(msg=error)
data = json.loads(result)
try:
dependencies = data['data']['trees']
except KeyError:
missing.append(self.name)
return installed, missing
for json_line in result.strip().split('\n'):
data = json.loads(json_line)
if self.globally:
if data['type'] == 'list' and data['data']['type'].startswith('bins-'):
# This is a string in format: 'bins-<PACKAGE_NAME>'
installed.append(data['data']['type'][5:])
else:
if data['type'] == 'tree':
dependencies = data['data']['trees']
for dep in dependencies:
name, version = dep['name'].rsplit('@', 1)
installed.append(name)
for dep in dependencies:
name, version = dep['name'].rsplit('@', 1)
installed.append(name)
if self.name not in installed:
missing.append(self.name)

View File

@@ -152,11 +152,11 @@ stdout:
sample: "org.gnome.Calendar/x86_64/stable\tcurrent\norg.gnome.gitg/x86_64/stable\tcurrent\n"
'''
from distutils.version import StrictVersion
from ansible.module_utils.six.moves.urllib.parse import urlparse
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
OUTDATED_FLATPAK_VERSION_ERROR_MESSAGE = "Unknown option --columns=application"
@@ -172,7 +172,7 @@ def install_flat(module, binary, remote, names, method, no_dependencies):
id_names.append(name)
base_command = [binary, "install", "--{0}".format(method)]
flatpak_version = _flatpak_version(module, binary)
if StrictVersion(flatpak_version) < StrictVersion('1.1.3'):
if LooseVersion(flatpak_version) < LooseVersion('1.1.3'):
base_command += ["-y"]
else:
base_command += ["--noninteractive"]
@@ -196,7 +196,7 @@ def uninstall_flat(module, binary, names, method):
]
command = [binary, "uninstall"]
flatpak_version = _flatpak_version(module, binary)
if StrictVersion(flatpak_version) < StrictVersion('1.1.3'):
if LooseVersion(flatpak_version) < LooseVersion('1.1.3'):
command += ["-y"]
else:
command += ["--noninteractive"]

View File

@@ -102,6 +102,12 @@ EXAMPLES = '''
state: present
install_options: 'debug,appdir=/Applications'
- name: Install cask with force option
community.general.homebrew_cask:
name: alfred
state: present
install_options: force
- name: Allow external app
community.general.homebrew_cask:
name: alfred
@@ -140,7 +146,8 @@ EXAMPLES = '''
import os
import re
import tempfile
from distutils import version
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
from ansible.module_utils.common.text.converters import to_bytes
from ansible.module_utils.basic import AnsibleModule
@@ -493,7 +500,7 @@ class HomebrewCask(object):
def _brew_cask_command_is_deprecated(self):
# The `brew cask` replacements were fully available in 2.6.0 (https://brew.sh/2020/12/01/homebrew-2.6.0/)
return version.LooseVersion(self._get_brew_version()) >= version.LooseVersion('2.6.0')
return LooseVersion(self._get_brew_version()) >= LooseVersion('2.6.0')
# /checks ------------------------------------------------------ }}}
# commands ----------------------------------------------------- {{{
@@ -599,7 +606,7 @@ class HomebrewCask(object):
self.message = 'Invalid cask: {0}.'.format(self.current_cask)
raise HomebrewCaskException(self.message)
if self._current_cask_is_installed():
if '--force' not in self.install_options and self._current_cask_is_installed():
self.unchanged_count += 1
self.message = 'Cask already installed: {0}'.format(
self.current_cask,

View File

@@ -97,9 +97,10 @@ RETURN = r''' # '''
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.common.text.converters import to_native
from distutils.version import StrictVersion
import os
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
class Mas(object):
@@ -145,7 +146,7 @@ class Mas(object):
# Is the version recent enough?
rc, out, err = self.run(['version'])
if rc != 0 or not out.strip() or StrictVersion(out.strip()) < StrictVersion('1.5.0'):
if rc != 0 or not out.strip() or LooseVersion(out.strip()) < LooseVersion('1.5.0'):
self.module.fail_json(msg='`mas` tool in version 1.5.0+ needed, got ' + out.strip())
def check_signin(self):

View File

@@ -135,10 +135,10 @@ import re
import shlex
import sqlite3
from distutils.version import StrictVersion
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
# Function used for executing commands.
def execute_command(cmd, module):
@@ -435,7 +435,7 @@ def parse_package_name(names, pkg_spec, module):
if pkg_spec[name]['branch']:
branch_release = "6.0"
if StrictVersion(platform.release()) < StrictVersion(branch_release):
if LooseVersion(platform.release()) < LooseVersion(branch_release):
module.fail_json(msg="package name using 'branch' syntax requires at least OpenBSD %s: %s" % (branch_release, name))
# Sanity check that there are no trailing dashes in flavor.

View File

@@ -17,7 +17,7 @@ description:
options:
name:
description:
- Package name or a list of packages.
- Package name or a list of package names with optional wildcards.
type: list
required: true
elements: str
@@ -74,10 +74,17 @@ state:
sample: present
'''
import re
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.common.text.converters import to_native
from fnmatch import fnmatch
# on DNF-based distros, yum is a symlink to dnf, so we try to handle their different entry formats.
NEVRA_RE_YUM = re.compile(r'^(?P<exclude>!)?(?P<epoch>\d+):(?P<name>.+)-'
r'(?P<version>.+)-(?P<release>.+)\.(?P<arch>.+)$')
NEVRA_RE_DNF = re.compile(r"^(?P<exclude>!)?(?P<name>.+)-(?P<epoch>\d+):(?P<version>.+)-"
r"(?P<release>.+)\.(?P<arch>.+)$")
class YumVersionLock:
def __init__(self, module):
@@ -102,6 +109,15 @@ class YumVersionLock:
self.module.fail_json(msg="Error: " + to_native(err) + to_native(out))
def match(entry, name):
m = NEVRA_RE_YUM.match(entry)
if not m:
m = NEVRA_RE_DNF.match(entry)
if not m:
return False
return fnmatch(m.group("name"), name)
def main():
""" start main program to add/remove a package to yum versionlock"""
module = AnsibleModule(
@@ -123,20 +139,20 @@ def main():
# Ensure versionlock state of packages
packages_list = []
if state in ('present'):
if state in ('present', ):
command = 'add'
for single_pkg in packages:
if not any(fnmatch(pkg.split(":", 1)[-1], single_pkg) for pkg in versionlock_packages.split()):
if not any(match(pkg, single_pkg) for pkg in versionlock_packages.split()):
packages_list.append(single_pkg)
if packages_list:
if module.check_mode:
changed = True
else:
changed = yum_v.ensure_state(packages_list, command)
elif state in ('absent'):
elif state in ('absent', ):
command = 'delete'
for single_pkg in packages:
if any(fnmatch(pkg, single_pkg) for pkg in versionlock_packages.split()):
if any(match(pkg, single_pkg) for pkg in versionlock_packages.split()):
packages_list.append(single_pkg)
if packages_list:
if module.check_mode:

View File

@@ -417,7 +417,9 @@ def package_present(m, name, want_latest):
# if a version is given leave the package in to let zypper handle the version
# resolution
packageswithoutversion = [p for p in packages if not p.version]
prerun_state = get_installed_state(m, packageswithoutversion)
prerun_state = {}
if packageswithoutversion:
prerun_state = get_installed_state(m, packageswithoutversion)
# generate lists of packages to install or remove
packages = [p for p in packages if p.shouldinstall != (p.name in prerun_state)]

View File

@@ -133,8 +133,6 @@ except ImportError:
XML_IMP_ERR = traceback.format_exc()
HAS_XML = False
from distutils.version import LooseVersion
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
from ansible.module_utils.urls import fetch_url
@@ -142,6 +140,8 @@ from ansible.module_utils.common.text.converters import to_text
from ansible.module_utils.six.moves import configparser, StringIO
from io import open
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
REPO_OPTS = ['alias', 'name', 'priority', 'enabled', 'autorefresh', 'gpgcheck']

View File

@@ -261,7 +261,6 @@ output:
'''
import datetime
import itertools
import os
import traceback
from functools import partial
@@ -283,6 +282,7 @@ except ImportError:
HAS_XMLJSON_COBRA = False
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
from ansible.module_utils.six.moves import zip_longest
from ansible.module_utils.urls import fetch_url
@@ -318,7 +318,7 @@ def merge(one, two):
return copy
elif isinstance(one, list) and isinstance(two, list):
return [merge(alpha, beta) for (alpha, beta) in itertools.izip_longest(one, two)]
return [merge(alpha, beta) for (alpha, beta) in zip_longest(one, two)]
return one if two is None else two

View File

@@ -15,7 +15,7 @@ short_description: Configuration of alerts in ManageIQ
extends_documentation_fragment:
- community.general.manageiq
author: Elad Alfassa (@elad661) <ealfassa@redhat.com
author: Elad Alfassa (@elad661) <ealfassa@redhat.com>
description:
- The manageiq_alerts module supports adding, updating and deleting alerts in ManageIQ.

View File

@@ -77,7 +77,8 @@ import traceback
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
from ansible.module_utils.api import basic_auth_argument_spec
from distutils.version import LooseVersion
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
GITLAB_IMP_ERR = None
try:

View File

@@ -249,7 +249,7 @@ class GitLabRunner(object):
return True
try:
runner = self._runners_endpoint.create(arguments)
runner = self._gitlab.runners.create(arguments)
except (gitlab.exceptions.GitlabCreateError) as e:
self._module.fail_json(msg="Failed to create runner: %s " % to_native(e))
@@ -293,10 +293,10 @@ class GitLabRunner(object):
# object, so we need to handle both
if hasattr(runner, "description"):
if (runner.description == description):
return self._runners_endpoint.get(runner.id)
return self._gitlab.runners.get(runner.id)
else:
if (runner['description'] == description):
return self._runners_endpoint.get(runner['id'])
return self._gitlab.runners.get(runner['id'])
'''
@param description Description of the runner

View File

@@ -104,7 +104,7 @@ def main():
# available alternatives
current_path_regex = re.compile(r'^\s*link currently points to (.*)$',
re.MULTILINE)
alternative_regex = re.compile(r'^(\/.*)\s-\spriority', re.MULTILINE)
alternative_regex = re.compile(r'^(\/.*)\s-\s(?:family\s\S+\s)?priority', re.MULTILINE)
match = current_path_regex.search(display_output)
if match:

View File

@@ -180,9 +180,9 @@ class DBusWrapper(object):
self.module.debug("Trying to detect existing D-Bus user session for user: %d" % uid)
for pid in psutil.pids():
process = psutil.Process(pid)
process_real_uid, dummy, dummy = process.uids()
try:
process = psutil.Process(pid)
process_real_uid, dummy, dummy = process.uids()
if process_real_uid == uid and 'DBUS_SESSION_BUS_ADDRESS' in process.environ():
dbus_session_bus_address_candidate = process.environ()['DBUS_SESSION_BUS_ADDRESS']
self.module.debug("Found D-Bus user session candidate at address: %s" % dbus_session_bus_address_candidate)
@@ -198,6 +198,9 @@ class DBusWrapper(object):
# This can happen with things like SSH sessions etc.
except psutil.AccessDenied:
pass
# Process has disappeared while inspecting it
except psutil.NoSuchProcess:
pass
self.module.debug("Failed to find running D-Bus user session, will use dbus-run-session")

View File

@@ -158,11 +158,12 @@ diversion:
import re
import os
from distutils.version import LooseVersion
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.common.text.converters import to_bytes, to_native
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
def diversion_state(module, command, path):
diversion = dict(path=path, state='absent', divert=None, holder=None)

View File

@@ -115,7 +115,6 @@ EXAMPLES = '''
fstype: vfat
'''
from distutils.version import LooseVersion
import os
import platform
import re
@@ -124,6 +123,8 @@ import stat
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.common.text.converters import to_native
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
class Device(object):
def __init__(self, module, path):

View File

@@ -28,7 +28,7 @@ options:
description:
- The port on which the iSCSI target process listens.
type: str
default: 3260
default: '3260'
target:
description:
- The iSCSI target name.

View File

@@ -56,13 +56,14 @@ pids:
import abc
import re
from distutils.version import LooseVersion
from os.path import basename
from ansible.module_utils import six
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
from ansible.module_utils.common.text.converters import to_native
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
try:
import psutil

View File

@@ -91,7 +91,7 @@ import operator
HAS_DISTUTILS = False
try:
import pkg_resources
from distutils.version import LooseVersion
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
HAS_DISTUTILS = True
except ImportError:
pass
@@ -153,7 +153,7 @@ def main():
'desired': dep,
}
else:
results['mismatched'] = {
results['mismatched'][pkg] = {
'installed': existing,
'desired': dep,
}

View File

@@ -20,7 +20,6 @@ options:
- The domain that will be added or removed from the list of permissive domains.
type: str
required: true
default: ''
aliases: [ name ]
permissive:
description:

View File

@@ -386,7 +386,6 @@ def deactivate_vdo(module, vdoname, vdocmd):
def add_vdooptions(params):
vdocmdoptions = ""
options = []
if params.get('logicalsize') is not None:
@@ -437,7 +436,7 @@ def add_vdooptions(params):
if params.get('physicalthreads') is not None:
options.append("--vdoPhysicalThreads=" + params['physicalthreads'])
return vdocmdoptions
return options
def run_module():

View File

@@ -107,23 +107,26 @@ RETURN = '''
- The type of the value that was changed (C(none) for C(get) and C(reset)
state). Either a single string value or a list of strings for array
types.
- This is a string or a list of strings.
returned: success
type: string or list of strings
type: any
sample: '"int" or ["str", "str", "str"]'
value:
description:
- The value of the preference key after executing the module. Either a
single string value or a list of strings for array types.
- This is a string or a list of strings.
returned: success
type: string or list of strings
type: any
sample: '"192" or ["orange", "yellow", "violet"]'
previous_value:
description:
- The value of the preference key before executing the module (C(none) for
C(get) state). Either a single string value or a list of strings for array
types.
- This is a string or a list of strings.
returned: success
type: string or list of strings
type: any
sample: '"96" or ["red", "blue", "green"]'
'''

View File

@@ -95,10 +95,11 @@ EXAMPLES = """
import os
import tempfile
import traceback
from distutils.version import LooseVersion
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
from ansible.module_utils.common.text.converters import to_native
from ansible_collections.community.general.plugins.module_utils.version import LooseVersion
PASSLIB_IMP_ERR = None
try:
from passlib.apache import HtpasswdFile, htpasswd_context

View File

@@ -669,7 +669,14 @@ class JIRA(StateModuleHelper):
try:
error = json.loads(info['body'])
except Exception:
self.module.fail_json(msg=to_native(info['body']), exception=traceback.format_exc())
msg = 'The request "{method} {url}" returned the unexpected status code {status} {msg}\n{body}'.format(
status=info['status'],
msg=info['msg'],
body=info.get('body'),
url=url,
method=method,
)
self.module.fail_json(msg=to_native(msg), exception=traceback.format_exc())
if error:
msg = []
for key in ('errorMessages', 'errors'):

View File

@@ -8,7 +8,7 @@
state: present
# xfsprogs on OpenSUSE requires Python 3, skip this for our newer Py2 OpenSUSE builds
when: not (item == 'xfsprogs' and ansible_os_family == 'Suse' and ansible_python.version.major == 2 and ansible_distribution_major_version|int != 42)
with_items:
loop:
- e2fsprogs
- xfsprogs
@@ -32,12 +32,11 @@
- name: "Install btrfs progs (OpenSuse)"
ansible.builtin.package:
name: '{{ item }}'
name:
- python{{ ansible_python.version.major }}-xml
- btrfsprogs
state: present
when: ansible_os_family == 'Suse'
with_items:
- python{{ ansible_python.version.major }}-xml
- btrfsprogs
- name: "Install reiserfs utils (Fedora)"
ansible.builtin.package:
@@ -46,9 +45,11 @@
when:
- ansible_distribution == 'Fedora' and (ansible_facts.distribution_major_version | int < 35)
- name: "Install reiserfs (OpenSuse)"
- name: "Install reiserfs and util-linux-systemd (for findmnt) (OpenSuse)"
ansible.builtin.package:
name: reiserfs
name:
- reiserfs
- util-linux-systemd
state: present
when:
- ansible_os_family == 'Suse'
@@ -100,10 +101,9 @@
- name: "Install dosfstools and lvm2 (Linux)"
ansible.builtin.package:
name: '{{ item }}'
with_items:
- dosfstools
- lvm2
name:
- dosfstools
- lvm2
when: ansible_system == 'Linux'
- name: "Install fatresize and get version"

View File

@@ -0,0 +1,6 @@
shippable/posix/group1
skip/aix
skip/freebsd
skip/rhel
skip/docker
skip/python2.6

View File

@@ -0,0 +1 @@
cask: brooklyn

View File

@@ -0,0 +1,71 @@
####################################################################
# WARNING: These are designed specifically for Ansible tests #
# and should not be used as examples of how to write Ansible roles #
####################################################################
# Test code for the homebrew_cask module.
# Copyright: (c) 2022, Joseph Torcasso <jtorcass@redhat.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
---
- name: Find brew binary
command: which brew
register: brew_which
when: ansible_distribution in ['MacOSX']
- name: Get owner of brew binary
stat:
path: "{{ brew_which.stdout }}"
register: brew_stat
when: ansible_distribution in ['MacOSX']
- block:
- name: Install cask
homebrew_cask:
name: "{{ cask }}"
state: present
become: yes
become_user: "{{ brew_stat.stat.pw_name }}"
register: cask_install_result
- assert:
that:
- cask_install_result is changed
- "'Cask installed' in cask_install_result.msg"
- name: Install cask (idempotence)
homebrew_cask:
name: "{{ cask }}"
state: present
become: yes
become_user: "{{ brew_stat.stat.pw_name }}"
register: cask_install_result
- assert:
that:
- cask_install_result is not changed
- "'Cask installed' not in cask_install_result.msg"
- "'Cask already installed' in cask_install_result.msg"
- name: Install cask with force install option
homebrew_cask:
name: "{{ cask }}"
state: present
install_options: force
become: yes
become_user: "{{ brew_stat.stat.pw_name }}"
register: cask_install_result
- assert:
that:
- cask_install_result is changed
- "'Cask installed' in cask_install_result.msg"
always:
- name: Delete cask
homebrew_cask:
name: "{{ cask }}"
state: absent
install_options: force
become: yes
become_user: "{{ brew_stat.stat.pw_name }}"
ignore_errors: yes

View File

@@ -504,6 +504,13 @@
state: absent
register: result20
- name: test-values 20 - remove section 'drinks' again to ensure idempotency"
ini_file:
path: "{{ output_file }}"
section: drinks
state: absent
register: result20_remove_again
- name: test-values 20 - read content from output file
slurp:
src: "{{ output_file }}"
@@ -517,6 +524,7 @@
assert:
that:
- result20 is changed
- result20_remove_again is not changed
- result20.msg == 'section removed'
- content20 == "\n"

Some files were not shown because too many files have changed in this diff Show More