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

411 commits

Author SHA1 Message Date
Felix Fontein
674b1da8bf
Improve hwclock support test. (#4904) 2022-06-30 07:30:12 +02:00
Felix Fontein
297de3011c
Fix CI due to pycdlib dropping Python 2 support. (#4865) 2022-06-21 14:12:21 +02:00
Jon Ellis
97c72f88b7
Sudoers validate (#4794)
* Use visudo to validate sudoers rules before use

* Replace use of subprocess.Popen with module.run_command

* Switch out apt for package

* Check file mode when verifying file to determine whether something needs to change

* Only install sudo package for debian and redhat environments (when testing)

* Attempt to install sudo on FreeBSD too

* Try just installing sudo for non-darwin machines

* Don't validate file ownership

* Attempt to install sudo on all platforms

* Revert "Attempt to install sudo on all platforms"

This reverts commit b9562a8916.

* Remove file permissions changes from this PR

* Add changelog fragment for 4794 sudoers validation

* Add option to control when sudoers validation is used

* Update changelog fragment

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

* Add version_added to validation property

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

* Also validate failed sudoers validation error message

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

* Make visudo not executable instead of trying to delete it

* Update edge case validation

* Write invalid sudoers file to alternative path to avoid breaking sudo

* Don't try to remove or otherwise modify visudo on Darwin

* Update plugins/modules/system/sudoers.py

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

* Remove trailing extra empty line to appease sanity checker

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-06-21 12:41:24 +02:00
ahussey-redhat
45362d39a2
Add keyring and keyring_info modules (#4764) 2022-06-20 19:15:08 +02:00
s-hamann
44e21dd407
sudoers: fix handling of state: absent (#4852) (#4853)
* sudoers: fix handling of state: absent (#4852)

* typo fixes
2022-06-19 15:34:24 +02:00
grembo
006f3bfa89
passwordstore: Make compatible with shims (#4780)
* passwordstore: Make compatible with shims, add backend config

This allows using the passwordstore plugin with scripts that wrap other
password managers. Also adds an explicit configuration (`backend` in
`ini` and `passwordstore_backend` in `vars`) to set the backend to `pass`
(the default) or `gopass`, which allows using gopass as the backend
without the need of a wrapper script. Please be aware that gopass
support is currently limited, but will work for basic operations.

Includes integrations tests.

Resolves #4766

* Apply suggestions from code review
2022-06-15 08:08:04 +02:00
Felix Fontein
84d8ca9234
Fix alternatives module (#4836)
* Only pass subcommands when they are specified as module arguments.

* When 'subcommands' is specified, 'link' must be given for every subcommand.

* Extend subcommand tests.
2022-06-14 16:02:31 +02:00
Marius Rieder
57e83ac80b
alternatives: Fix bug with priority default (#4810)
* alternatives: Fix bug with priority default

If neigther the priority nor the subcommands where specified the module decided to update the priority with the default value anyway. This resulted in bug #4803 and #4804

* Add changelog fragment.

* Distinguish None from 0.

* Address review comments.

* Update plugins/modules/system/alternatives.py

Co-authored-by: Pilou <pierre-louis@libregerbil.fr>

* Remove unrelated issues from changelog.

Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Pilou <pierre-louis@libregerbil.fr>
2022-06-13 21:40:02 +02:00
Jon Ellis
2d1e58663c
Ensure managed sudoers config files have 0440 permissions (#4814)
* Ensure sudoers config files are created with 0440 permissions to appease visudo validation

* Remove change not required by the bugfix

* Add changelog fragment for 4814 sudoers file permissions

* Update changelogs/fragments/4814-sudoers-file-permissions.yml

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

* Have less oct casting

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

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-06-12 08:17:56 +02:00
Felix Fontein
dd24c98fe5
CI: Disable repo URL test for OpenSuSE 15.4 (#4805)
* Disable repo URL test for OpenSuSE 15.4.

* Forgot some places.
2022-06-08 12:48:55 +02:00
Marius Rieder
373da56b5b
Add subcommands parameter for module alternatives. (#4654)
* Add slaves parameter for module alternatives.

* alternatives: Improve documentation abous slaves parameter

* alternatives: Apply suggestions from code review

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

* alternatives: Add schangelog for slaves parameter

* alernatives: Add integration tests

* alternatives: Improv tests

* alternatives: Update tests/integration/targets/alternatives/tasks/slaves.yml

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

* alternatives: Rework logic to support updating priority and subcommands

* alternatives: Use more inclusive naming

* alternatives: Fix linter warnings

* alternatives: Dont fail if link is absent

* alternatives: Update changelog fragment

* alternatives: Add tests for prio change and removing

* alternatives: Apply suggestions from code review

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

* alternatives: Add `state=auto`to reset mode to auto

* alternatives: Fix linter warnings

* alternatives: Fix documentation.

* alternatives: Combine multiple messages.

* alternatives: Set command env for all commands.

* alternatives: Do not update subcommands if parameter is omited

* alternatives: Fix a bug with python 2.7 var scoping

* alternatives: Improce diff before generation

* alternatives: Fix linter warnings

* alternatives: Fix test names

* alternatives: Simplify subcommands handling and improve diffs

* aliases: Only test for subcommand changes if subcommands parameter is set.

* Update plugins/modules/system/alternatives.py

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

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-06-06 10:33:39 +02:00
Alexei Znamensky
2d38c8d892
cmd_runner: deprecate fmt as the name for the format class (#4777)
* cmd_runner: deprecate fmt as the name for the format class

* added changelog fragment

* fixing the deprecation comment
2022-06-05 18:37:59 +02:00
Alexei Znamensky
be69f95f63
cmd_runner: added flag check_mode_skip to context (#4736)
* cmd_runner: added flag skip_if_check_mode to context

* added changelog fragment

* adjusted param name and added new one
2022-06-04 09:13:37 +02:00
Felix Fontein
319c29c2a2
Add RHEL 9.0, FreeBSD 13.1, Ubuntu 22.04 and Fedora 36 to CI, fix bug in filesystem module (#4700)
* Add RHEL 9.0 and FreeBSD 13.1 to CI.

* RHEL 9 has no pyOpenSSL apparently.

* Adjust URL for EPEL.

* Fix cargo install on FreeBSD 13.1.

* Add Ubuntu 22.04 and Fedora 36 to CI.

* Fix logic.

* filesystem: do not die output line does not contain ':'

* Skip django_manage tests on RHEL 9 as well.

* homectl tests don't work with RHEL 9.0.

* Improve error handling, improve fatresize output handling.

* Skip Fedora 36.

* Skip filesystem vfat tests on Ubuntu 22.04.

There, resizing fails with a bug:
Bug: Assertion (disk != NULL) at ../../libparted/disk.c:1620 in function ped_disk_get_partition_by_sector() failed.

* 'trusty' is 14.04. Adding 22.04 to skip list.

* Skip jail tests for FreeBSD 13.1.

* Add config for postgres on Ubuntu 22.04.

* Make CentOS 6 happy.

* Adjust postgres version.

* Try installing EPEL a bit differently.

* Skip ufw and iso_extract tests on RHEL 9.

* Skip odbc tests on RHEL 9.

* Skip RHEL 9.0 for snap tests.

* Add changelog fragment for filesystem code changes.
2022-05-22 17:20:30 +02:00
Felix Fontein
8421af1ea3
certifi dropped Python 2 support (#4702)
* certifi dropped Python 2 support.

* Apparently the consul tests didn't use the constraints.
2022-05-19 14:48:03 +02:00
Felix Fontein
ae7f2f25cb
Disable the OpenNebula integration tests. (#4692) 2022-05-18 22:28:10 +02:00
Felix Fontein
f17d2669fa Disable failing test for CentOS 8. 2022-05-08 14:00:29 +02:00
Felix Fontein
9462506edc
Rename single-filter plugins so that the filename equals the filter name. (#4625) 2022-05-05 08:03:49 +02:00
René Moser
dd9afc09a8
time_filter: allow 0 to return 0 (#4612)
* time_filter: allow 0 to return 0

* add changelog

* Update changelogs/fragments/4612-time_filter_zero.yml

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

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-05-04 07:38:16 +02:00
Felix Fontein
1a9b3214fd
[5.0.0] Remove Ansible 2.9 / ansible-base 2.10 compatibility code (#4548)
* Remove Ansible 2.9 / ansible-base 2.10 compatibility code.

* Remove path_join shim from BOTMETA.

* Update comment.

* Bump minimally required ansible-core version.
2022-04-26 11:51:01 +02:00
Tanner Prestegard
29c49febd9
Add 'state' parameter for alternatives (#4557)
* Add 'activate' parameter for alternatives

Allow alternatives to be installed without being set as the current
selection.

* add changelog fragment

* Apply suggestions from code review

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

* rename 'activate' -> 'selected'

* rework 'selected' parameter -> 'state'

* handle unsetting of currently selected alternative

* add integration tests for 'state' parameter

* fix linting issues

* fix for Python 2.7 compatibility

* Remove alternatives file.

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-04-26 08:20:29 +02:00
CWollinger
d7e5e85f3e
New module alerta_customer (#4554)
* first draft of alerta_customer

* Update BOTMETA.yml

* update after review

* fix pagination and state description

* remove whitespace
2022-04-26 07:58:32 +02:00
Raymond Chang
1d3506490f
New Module: LXD Projects (#4521)
* add lxd_project module

* documentation improvement and version_added entry

* improve documentation

* use os.path.expanduser

* exclude from use-argspec-type-path test

* improve documentation
2022-04-25 22:20:54 +02:00
Alexei Znamensky
f5b1b3c6f0
Command Runner (#4476)
* initial commit, passing unit tests

* passing one very silly integration test

* multiple changes:

- updated copyright year
- cmd_runner
  - added fmt_optval
  - created specific exceptions
  - fixed bug in context class where values from module params were not
    being used for resolving cmd arguments
  - changed order of class declaration for readability purpose
- tests
  - minor improvements in integration test code
  - removed some extraneous code in msimple.yml
  - minor improvements in unit tests
  - added few missing cases to unit test

* multiple changes

cmd_runner.py

- renamed InvalidParameterName to MissingArgumentFormat
  - improved exception parameters
- added repr and str to all exceptions
- added unpacking decorator for fmt functions
- CmdRunner
  - improved parameter validation
- _CmdRunnerContext
  - Context runs must now pass named arguments
  - Simplified passing of additional arguments to module.run_command()
  - Provided multiple context variables with info about the run

Integration tests

- rename msimple.py to cmd_echo.py for clarity
- added more test cases

* cmd_runner: env update can be passed to runner

* adding runner context info to output

* added comment on OrderedDict

* wrong variable

* refactored all fmt functions into static methods of a class

Imports should be simpler now, only one object fmt, with attr access to all callables

* added unit tests for CmdRunner

* fixed sanity checks

* fixed mock imports

* added more unit tests for CmdRunner

* terminology consistency

* multiple adjustments:

- remove extraneous imports
- renamed some variables
- added wrapper around arg formatters to handle individual arg ignore_none behaviour

* removed old code commented out in test

* multiple changes:

- ensure fmt functions return list of strings
- renamed fmt parameter from `option` to `args`
- renamed fmt.mapped to fmt.as_map
- simplified fmt.as_map
- added tests for fmt.as_fixed

* more improvements in formats

* fixed sanity

* args_order can be a string (to be split())

and improved integration test

* simplified integration test

* removed overkill str() on values - run_command does that for us

* as_list makes more sense than as_str in that context

* added changelog fragment

* Update plugins/module_utils/cmd_runner.py

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

* adjusted __repr__ output for the exceptions

* added superclass object to classes

* added additional comment on the testcase sample/example

* suggestion from PR

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-04-25 22:12:00 +02:00
Felix Fontein
26cebb9c30
CI: remove FreeBSD 12.0 and 12.2, re-enable pkgng tests (#4511)
* Remove FreeBSD 12.0 and 12.2 from CI.

* Revert "Temporarily disable the pkgng tests. (#4493)"

This reverts commit 5ecac692de.
2022-04-16 12:09:35 +02:00
Martin
3c515dd221
pacman: Fix removing locally installed packages (#4464)
* pacman: Fix removing locally installed packages

Without this, using `absent` state for a locally installed package (for example from AUR, or from a package that was dropped from repositories) would return that package is already removed, despite remaining installed

* Undo unwanted whitespace removal

* Add changelog fragment

* Update changelogs/fragments/4464-pacman-fix-local-remove.yaml

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

* Add test.

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-04-13 13:34:33 +02:00
Kamil Markowicz
e4a25beedc
Terraform init -upgrade flag (#4455)
* Adds optional `-upgrade` flag to terraform init.

This allows Terraform to install provider dependencies into an existing project when the provider constraints change.

* fix transposed documentation keys

* Add integration tests for terraform init

* Revert to validate_certs: yes for general public testing

* skip integration tests on irrelevant platforms

* skip legacy Python versions from CI tests

* add changelog fragment

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

Adds version_added metadata to the new module option.

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

* Change terraform_arch constant to Ansible fact mapping

* correct var typo, clarify task purpose

* Squashed some logic bugs, added override for local Terraform

If `existing_terraform_path` is provided, the playbook will not download Terraform or check its version.

I also tested this on a local system with Terraform installed, and squashed some bugs related to using of an
existing binary.

* revert to previous test behavior for TF install

* readability cleanup

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

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-04-13 11:16:54 +00:00
elara-leitstellentechnik
8ccc4d1fbb
Implement btrfs resize support (#4465)
* Implement btrfs resize support

* Add changelog fragment for btrfs resize support

Co-authored-by: Fabian Klemp <fabian.klemp@frequentis.com>
2022-04-13 07:07:51 +02:00
Felix Fontein
5ecac692de
Temporarily disable the pkgng tests. (#4493) 2022-04-11 20:10:49 +02:00
CWollinger
aa045d2655
Add discord integration tests (#4463)
* add discord integration tests

* fix: var name in readme
2022-04-10 08:41:46 +02:00
Alexei Znamensky
9e0ff8ba4b
cronvar: ensure creation of /etc/cron.d in test (#4440)
* ensure creation of /etc/cron.d in test

* fixed typo
2022-04-02 18:18:59 +02:00
Alexei Znamensky
21ee4c84b7
pids: re-enabled tests on Alpine Linux (#4405)
* [WIP] pids: re-enabled tests on Alpine Linux

* trying to compile a simple-faked sleep command

* make FreeBSD happy

* remove the block testing for Alpine Linux

* simpler version of sleeper.c

* simpler version of sleeper.c, part II

* Update tests/integration/targets/pids/tasks/main.yml

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

* Update tests/integration/targets/pids/tasks/main.yml

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

* added license to sleeper.c file

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-04-02 08:18:19 +02:00
Felix Fontein
24ca69aa05
CI: Remove 'warn:' that's removed in ansible-core 2.14 (#4434)
* Remove 'warn:' that's removed in ansible-core 2.14.

* Install virtualenv when needed.
2022-04-01 22:53:05 +02:00
doubletwist13
17fe813c18
feat: sudoers module supports runas parameter with default of root (#4380)
* feat: sudoers module supports runas parameter with default of root

* fix: sudoers tests now pass

* chore: add changelog fragment for 4380

* fix: runas feature now a non-breaking change wh no def with no default

* fix: no trailing space in sudoers.py

* Update plugins/modules/system/sudoers.py

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

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-03-24 07:07:07 +01:00
Felix Fontein
cf4d68ac50
pacman: implement change detection for update_cache=true; add cache_updated return value (#4337)
* Implement change detection for update_cache=true. Add cache_updated return value.

* ...

* Make sure pacman --sync --list is called only as often as necessary.
2022-03-15 05:38:59 +01:00
Jean Raby
c698ecd201
pacman: add support for remove_nosave (#4316)
* pacman: add support for remove_nosave

New parameter: remove_nosave
When enabled, will pass --nosave to pacman when removing packages.
--nosave cannot be used with --print-format and thus it couldn't be
passed via extra_args. See #4315

The code adds the option right before the actual removal of the pkgs.

(This is based on an initial diff from MorphBonehunter)

* changelog

* Update plugins/modules/packaging/os/pacman.py

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

* wording

* ssss

* remove_package: simplify {force,extra,nosave}_args

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-03-08 07:21:40 +01:00
Jean Raby
a9db4742fc
pacman: re-adding support for URL based pkgs (#4286)
* pacman: re-adding support for URL based pkgs

* Update plugins/modules/packaging/os/pacman.py

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

* Update plugins/modules/packaging/os/pacman.py

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

* cmd=cmd in every call to self.fail()

* pacman: integration test for mixed pkg sources

* Add more tests + fix minor bug with URL packages

Version checking for URL packages is left to pacman, so add a check
after the dry run to see if it would actually install anything.

* remove double templating

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-03-01 06:03:18 +01:00
Felix Fontein
14ef334754
Make timezone tests work on Alpine. (#4292) 2022-02-27 13:55:03 +01:00
Felix Fontein
274b8cceef
Improve ArchLinux tests (#4291)
* Make sure that every test that uses package: requires setup_pkg_mgr.

* Upgrade system packages for Arch Linux.

* Re-enable java keytool tests on Arch.
2022-02-27 13:51:26 +01:00
quidame
0da8cb2e02
filesize: fix alpine linux sparse file (#4288)
* 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>
2022-02-27 13:45:41 +01:00
Felix Fontein
be433d762b
Add very basic integration tests for pcaman. (#4289) 2022-02-27 13:04:14 +01:00
Felix Fontein
0d0e695d8f
Temporarily disable Java keytool installation on Archlinux (#4283)
* Temporarily disable Java keytool installation on Archlinux.

* Fix comment.
2022-02-24 23:11:20 +01:00
Felix Fontein
2b0b780ccb
Re-enable ansible_galaxy_install tests. (#4253) 2022-02-22 23:01:23 +01:00
Felix Fontein
06705348e3
Temporarily disable ansible_galaxy_install tests due to Galaxy failures. (#4247) 2022-02-22 09:20:32 +01:00
Felix Fontein
a06903f33a
CI: Add ArchLinux, Debian Bullseye, CentOS Stream 8, and Alpine 3 (#4222)
* Add ArchLinux, Debian Bullseye and CentOS Stream 8 to CI.

* Add Alpine to CI matrix as well.
2022-02-21 21:14:45 +01:00
Sebastian Guarino
44f9bf545d
Rework of gitlab_project_variable over gitlab_group_variable (#4086)
* Rework of gitlab_project_variable over gitlab_group_variable

* Linting and removed unused example

* Fix test 2

* Sync from review of gitlab_project_variable #4038

* Linting, default protected True, value optional

* Next version is 4.5.0

* Roll back protected default true, and value not required

* Apply suggestions from code review

Missing check_mode

Co-authored-by: Markus Bergholz <git@osuv.de>

* Fix one unit test, comment test that requires premium gitlab

* Add changelog

* Update plugins/modules/source_control/gitlab/gitlab_group_variable.py

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

* Update changelogs/fragments/4086-rework_of_gitlab_proyect_variable_over_gitlab_group_variable.yml

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

* Added conditional gitlab_premium_tests variable when required

* Allow delete without value

* Fix variable name

* Linting

* Value should not be required in doc

* Linting missing new-line

* Update changelogs/fragments/4086-rework_of_gitlab_proyect_variable_over_gitlab_group_variable.yml

Co-authored-by: Markus Bergholz <git@osuv.de>

Co-authored-by: Markus Bergholz <git@osuv.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
2022-02-18 20:58:38 +01:00
James Livulpi
f527bb61f9
ini_file: Don't report changed=true when removing if nothing is changed. (#4155)
* 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>
2022-02-17 13:35:46 +01:00
Markus Bergholz
69551ac325
gitlab_project_variable: Allow delete without value (#4150)
* value is not required when state is absent

* fix integration test. missing value

* fix condition

* add changelog fragment

* fail fast

* try required_if on suboptions

* revert

* Update plugins/modules/source_control/gitlab/gitlab_project_variable.py

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

* fix naming in doc

* typo in name

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-02-05 21:02:04 +01:00
Joseph Torcasso
8b95c56030
homebrew_cask: reinstall when force is install option (#4090)
* 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
2022-02-02 21:31:05 +01:00
Felix Fontein
24f7a3b6ad
Try to fix CentOS 8 in CI - at least a bit. (#4132) 2022-01-31 20:57:46 +01:00