snap: add tests for multiple commands (#5488)
* snap: add tests for multiple commands
* snap: add tests + become
* remove packages again for idempotency
* roll back become=true in tests
(cherry picked from commit d7340945a4)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
redhat_subscription: use CLI when using environments (#6319)
It turns out that the 'environments' that the D-Bus Register*() APIs
accept are the IDs of the environments, and not the user-facing names of
the environments (which is what the module has been accepting so far).
Since there is no easy way to do the mapping manually, for now use again
the subscription-manager CLI for registering when environments are
specified.
(cherry picked from commit 83994c0a2d)
Co-authored-by: Pino Toscano <ptoscano@redhat.com>
terraform: remote state file exists check issue (#6296)
* remote state file exists check
In the official CLI implementation of Terraform, if the state file does not exist, a new one will be created, and there is no need to check that the state file already exists and with an error if file not exists.
```bash
# Test command
terraform apply -state test.tfstate. # if state file not exists ,terraform will create a new one
terraform destroy -state test1.tfstate ### Terraform will not throw any error, the command will succeed execute, only report no resource has destroy
```
* Update terraform.py
add 1 blank line to function end
* Create 6296-LanceNero-Terraform_statefile_check
remove file exists check (https://github.com/ansible-collections/community.general/pull/6296)
* resolve if case issue
* Add blank line
* Update 6296-LanceNero-Terraform_statefile_check
* Update changelogs/fragments/6296-LanceNero-Terraform_statefile_check
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
* update code style
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
* Update suffix to correct CI issue
* Update Code Style
* Update bug-fix to feature release
---------
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
(cherry picked from commit bf780ea738)
Co-authored-by: LanceNero <Lance.nero@gmail.com>
dconf: three minor but useful fixes (#6206)
* dconf: Correctly handle setting a key that has no value in DB
We need to check if the value in the database is None before we try to
parse it, because the GVariant parser won't accept None as an input
value. By definition if the value is None, i.e., there's no value in
the database, than any value the user is trying to set is a change, so
just indicate that it's a change without trying to compare the None to
whatever the user specified as the value.x
* dconf: Give a more useful error when writing a key fails
if writing a key fails, then include in the error that is returned the
exact key and value aguments that were given to the dconf command, to
assist in diagnosing failures caused by providing the key or value in
the wrong format.x
* dconf: Convert boolean values into the format that dconf expects
Even though we warn users to be careful to specify GVariant strings
for values, a common error is to be trying to specify a boolean string
which ends up getting converted into a boolean by the YAML parser or
Ansible. Then it gets converted to "True" or "False", the string
representations of Python booleans, which are not valid GVariants.
Rather than just failing with an obscure error when this happens,
let's be more user-friendly and detect when the user has specified a
boolean and convert it into the correct GVariant forms, "true" or
"false", so it just works. There's no good reason to be more pedantic
than that.
(cherry picked from commit a5765143f1)
Co-authored-by: Jonathan Kamens <jik@kamens.us>
Remove nibalizer from puppet module (#6320)
Sorry! I haven't had time to work on this in a while. Cheers!
(cherry picked from commit 86f9a657e7)
Co-authored-by: Spencer Krum <nibz@spencerkrum.com>
archive: Generate crc32 over 16MiB chunks (#6274)
* archive: Generate crc32 over 16MiB chunks
Running crc32 over the whole content of the compressed file potentially
requires a lot of RAM. The crc32 function in zlib allows for calculating
the checksum in chunks. This changes the code to calculate the checksum
over 16 MiB chunks instead. 16 MiB is the value also used by
shutil.copyfileobj().
* Update changelogs/fragments/6199-archive-generate-checksum-in-chunks.yml
Change the type of change to bugfix
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update changelogs/fragments/6199-archive-generate-checksum-in-chunks.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 14b19afc9a)
Co-authored-by: Nils Meyer <nils@nm.cx>
homebrew: respect greedy flag for cask upgrade_all (#6267)
* homebrew: respect greedy flag for cask upgrade_all
* homebrew: implement feedback from code review
(cherry picked from commit 6c5c05dfdc)
Co-authored-by: Claude Becker <becker@phys.ethz.ch>
pkgng: skip jail tests also on FreeBSD 12.3 (#6313)
Skip jail tests also on FreeBSD 12.3.
(cherry picked from commit aa77a88f4b)
Co-authored-by: Felix Fontein <felix@fontein.de>
pipx: Add support for system_site_packages (#6308)
* pipx: Add support for system_site_packages
* Add changelog fragment
(cherry picked from commit f93a1bf5ec)
Co-authored-by: Paul Aurich <paul@darkrain42.org>
pids tests: 'some-' is not that a unique pattern. (#6304)
* 'some-' is not that a unique pattern.
* Add debugging help.
* Avoid passing the name as a parameter to obtainpid.sh.
(cherry picked from commit 08f14f3eb0)
Co-authored-by: Felix Fontein <felix@fontein.de>
Add support to topics on Gitlab Project module (#6278)
* add topics to gitlab_project.py
* add chngelog fragment
* fix lint error
* Update changelogs/fragments/6277-add-topics-gitlab-project.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit cee5f31b70)
Co-authored-by: Lorenzo Tanganelli <35271287+tanganellilore@users.noreply.github.com>
redhat_subscription: fix D-Bus option for environments on CentOS (#6275)
Factorize the current logic to determine whether use 'environments' as
D-Bus registration option (rather than 'environment') in an own
function, so it is easier to read it and maintain it.
With the small helper function in place, extend the logic to support
CentOS: it is in practice the same as the RHEL one, with an additional
check to support CentOS Stream 8 (which is a rolling release, and not
versioned).
(cherry picked from commit c280b793de)
Co-authored-by: Pino Toscano <ptoscano@redhat.com>
Update maintainership of rhsm modules (#6261)
- remove Barnaby, Adrian, and Kevil from redhat_subscription, as they
are no more working on subscription-manager
- create a new team_rhsm group to maintain redhat_subscription,
rhsm_release, and rhsm_repository (all the modules related to
subscription-manager)
- add myself and cnsnyder to team_rhsm
(cherry picked from commit 9bb768ae62)
Co-authored-by: Pino Toscano <ptoscano@redhat.com>
redhat_subscription: manually unregister only when registered (#6259)
When registering using D-Bus and using a version of subscription-manager
with an unimplemented 'force' option, then unregister manually the
system only if it is registered. 'subscription-manager unregister'
errors out when trying to unregister an already unregistered system.
(cherry picked from commit c9e11e5c0c)
Co-authored-by: Pino Toscano <ptoscano@redhat.com>
pipx: document parameters supported with state=latest, and fix include_injected parameter (#6212)
* pipx: Document parameters supported with state=latest
* pipx: Support "include_injected" with states "upgrade" and "latest"
- Contrary to documentation, "include_injected" doesn't appear to have
worked with state=upgrade since it was introduced.
- Add support for include_injected with "latest", since "latest" is
specified as being install+upgrade.
* Add changelog fragment
* Update plugins/modules/pipx.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update changelog fragment
Co-authored-by: Felix Fontein <felix@fontein.de>
* pipx: Update to correct target release of community.general
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 33093e9f3e)
Co-authored-by: Paul Aurich <paul@darkrain42.org>
Add module to manipulate KDE config files using kwriteconfig (#6182)
* Add module to manipulate KDE config files using kwriteconfig
* Fix license issues
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
* Add smeso as kdeconfig.py maintainer
* Fix attributes fragment name
* Fix test
* Do not use shutil.chown
It isn't available on old Python versions
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 997761878c)
Co-authored-by: Salvatore Mesoraca <s.mesoraca16@gmail.com>
Fixed XenOrchestra inventory plugin failing due to not checking response ID. (#6227)
* Added call method to select proper response from xo server
* Added changelog fragment
* Removed excess blank lines
* Moved period in changelog fragment
* Made suggested changes
* Remove f-strings for Python 2.7 compatibility
Co-authored-by: Felix Fontein <felix@fontein.de>
---------
Co-authored-by: Linus Kirkwood <lkirkwood@allette.com.au>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit cd706454ec)
Co-authored-by: lirkwood <linuskirkwood@gmail.com>
nmcli: add runner_fast_rate option (#6148)
* add runner_fast_rate option
* unset default value for runner_fast_rate parameter
* add some commas
* Remove default in copy of argspec.
Co-authored-by: Sam Potekhin <eax24@ya.ru>
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Sam Potekhin <eax24@ya.ru>
(cherry picked from commit d4f272ba52)
Co-authored-by: Alex Groshev <38885591+haddystuff@users.noreply.github.com>
nmcli: fixed idempotency issue with 'may_fail4' when 'method' is 'disabled' (#6106)
* nmcli: fixed idempotency issue with 'may_fail4' when 'method' is 'disabled'
* added note to documentation
* updated changelog fragment
* Update changelog fragment.
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 5ee687049f)
Co-authored-by: Sam Potekhin <heaveaxy@gmail.com>
pipx: Allow injected modules to add apps (#6198)
* pipx: Allow injected modules to add apps
Add support for pipx inject's "--include-apps" parameter.
* add changelog fragment
* fix pipx test ("install_apps", not "include_apps")
* fix pipx test -- add a second invocation for install_apps
* Update changelogs/fragments/6198-pipx-inject-install-apps.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/pipx.py
Co-authored-by: Felix Fontein <felix@fontein.de>
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 6fa833feed)
Co-authored-by: Paul Aurich <paul@darkrain42.org>
added hpe thermal config and fan percent min (#6208)
* added hpe thermal config and fan percent min
* typo fixed
* Create 6208-hpe-thermal-fan-percent.yaml
* fixed changelog fragment
* Update 6208-hpe-thermal-fan-percent.yaml
(cherry picked from commit 33ccabed13)
Co-authored-by: ky13 <k.william.ritchie@gmail.com>
Add archive param for proxmox_kvm module (#6159)
We simply add a param to allow proxmox administrator to restore VM from
an archives. This new option will be useful to automate automatic
creation and restore of VM.
Co-authored-by: Julian Vanden Broeck <julian.vandenbroeck@dalibo.com>
(cherry picked from commit 7059789f35)
Co-authored-by: Julian <374571+l00ptr@users.noreply.github.com>
Add Gitlab group runners support (#3935)
(cherry picked from commit f3be0076af)
Co-authored-by: Léo GATELLIER <26511053+lgatellier@users.noreply.github.com>
apt_rpm: add clean, dist_upgrade and update_kernel (#5867)
* clean performs apt-get clean.
* dist_upgrade performs apt-get dist-upgrade.
* update_kernel performs update-kernel to upgrade kernel packages.
* update_cache, clean, dist_upgrade and update_kernel can be used with and without specified packages.
(cherry picked from commit b1d94385ae)
Co-authored-by: Andrey Cherepanov <sibskull@gmail.com>
redhat_subscription: require credentials only when needed (#5664)
The module currently has a static 'required_if' statement for its
parameters that forces any of 'username' or 'activationkey' or 'token'
in case state=present; while this is generally a good idea, it can be
an extra requirements in some cases. In particular, if the system is
already registered, there is no need for credentials -- some of the
operations of the module, such as manipulating pools, can be done
perfectly without credentials.
Hence:
- change the static 'required_if' to require credentials only when
forcing the registration
- check for credentials manually when a registration is needed, i.e.
on an unregistered system; the fail message is the same as the one
shown by 'required_if'
Adapt the tests to this new situation:
- test_without_required_parameters now needs to mock an unregistered
system
- add a new version of test_without_required_parameters to test an
already registered system
- add a simple test case for only state=present usable on an already
registered system
- remove the credentials from a test case for pool attachment that
mocks an already registered system
(cherry picked from commit bbd68e26a2)
Co-authored-by: Pino Toscano <ptoscano@redhat.com>
rhsm modules: cleanly fail when not run as root (#6211)
subscription-manager on RHEL installs a symlink in /usr/bin to
console-helper (part of usermode), which triggers an interactive prompt
for root credentials when run as user. It seems that console-helper
does not handle well non-interactive contexts (e.g. without a TTY for
input), and thus it will hang waiting for input when run as user in an
Ansible task.
Since subscription-manager requires root already anyway (and it will
fail when explicitly run as user), then apply the same logic locally on
all the modules that interact with it: redhat_subscription,
rhsm_release, and rhsm_repository.
(cherry picked from commit 9f67cbbe36)
Co-authored-by: Pino Toscano <ptoscano@redhat.com>
Fix influxdb_user grants in check mode (#6111)
* Fix influxdb_user grants in check mode
When running in check mode, `influxdb_user` will return error when the user doesn't exist yet, instead of reporting `changed` state.
* Update changelogs/fragments/6111-influxdb_user-check-mode.yaml
Co-authored-by: Felix Fontein <felix@fontein.de>
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 3fb1ff0b72)
Co-authored-by: Petr Tichý <petr@pex.com>
Replace deprecated error with BadZipFile (#6180)
* Replace deprecated error with BadZipFile
* Use imported BadZipFile
Co-authored-by: Felix Fontein <felix@fontein.de>
* Add news fragment
* Update new fragment
Co-authored-by: Felix Fontein <felix@fontein.de>
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit f66cc7c933)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Adding support for `-p` option to specify port(s) to scan (#6165)
* Adding support for `-p` option to specify port(s) to scan
* Adding changelog fragment file
* Corrected appending options
* Edit to doc section
* Correction in documentation type
* Fixed `:` use in doc breaking yaml
* Update changelogs/fragments/6165-nmap-port.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/inventory/nmap.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/inventory/nmap.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Adding usage example
* Adding comment to example that was missed
* Breaking line up, was too long for sanity test 160 char limit
* Still too long since spaces are counted
* Changed type to string to work for a single entry as well as comma separated values
* Update changelogs/fragments/6165-nmap-port.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/inventory/nmap.py
Co-authored-by: Felix Fontein <felix@fontein.de>
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit bf8f2950b4)
Co-authored-by: barloff-st <42866449+barloff-st@users.noreply.github.com>