1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-21 11:19:00 +00:00
community.general/changelogs/fragments
patchback[bot] 2873d439c3
[PR #11764/e9110811 backport][stable-12] logrotate: fix parameter and config file validation and more (#11856)
logrotate: fix parameter and config file validation and more (#11764)

* fix(logrotate): add missing defaults and parameter validation declarations

- Add default="present" to state parameter
- Add default="/etc/logrotate.d" to config_dir parameter
- Add required_by declarations for shred and compression parameters

* fix(logrotate): fix runtime validation bugs, remove duplicate checks

- Fix shred_cycles TypeError when value is None
- Fix enabled=None handling in get_config_path
- Remove duplicate runtime mutually_exclusive checks
- Add runtime boolean truthiness checks
- Add 'create' parameter format validation
- Remove stale test method

* fix(logrotate): restructure file operations, validate before write

- Write content to tmpdir temp file, validate, then atomic move to destination.
- Wrap all os.remove() calls in try/except with fail_json on error
- Wrap all module.atomic_move() calls in try/except with fail_json on error
- Also add self.mock_module.tmpdir = self.test_dir to test setUp for new code path

* docs(logrotate): update DOCUMENTATION block

- Add 'default: present' to state option
- Add 'default: /etc/logrotate.d' to config_dir option

* feat(logrotate): add optional backup parameter

* chore: add logrotate fixes changelog fragment

* chore(changelog/logrotate): use present tense singular

* fix(logrotate): handle trailing spaces in create param



* refactor(logrotate): remove redundant checks

These are already handled by `required_if` statements in the module spec

* refactor(logrotate): use tempfile to create temporary file

* refactor(logrotate): remove redundant `bool()` casts on `target_enabled`

`target_enabled` is guaranteed to be bool by this point. It's either the module param (typed bool) or falls back to `current_enabled` (also bool). The `bool()` wraps are no-ops.

* refactor(logrotate): remove unused `self.config_file` attribute

* refactor(logrotate): remove dead `any_state` parameter from `read_existing_config`

* fix(logrotate): raise error instead of falling through on enabled-state rename failures

* refactor(logrotate): tighten `get_config_path` sig to bool

`None` callers are removed now so this is safe

* test(logrotate): remove stale open mock assertion after tempfile refactor

* style(logrotate): format file

* chore(logrotate): add missing `version_added` attribute



* fix(logrotate): clean up temp file



* fix(logrotate): remove redundant temp file cleanup



* refactor(logrotate): Use dict subscript to access required backup param



* fix(logrotate): fix: only remove old config file when path differs from target



* fix(logrotate): update logrotate_bin type hint to str

* feat(logrotate): add backup file handling when removing old config

* style(logrotate): format file

* test(logrotate): add missing backup default to `_setup_module_params`

* test(logrotate): fix incorrect `os.remove` assertion in update test

* refactor(logrotate): remove unnecessary `to_native()` call



* refactor(logrotate): replace str quotes with !r



* fix(logrotate): change backup default back to true

* fix(logrotate): raise error when `shred_cycle`s is set with `shred=false`

* docs(logrotate): clarify `shred_cycles` behaviour

* fix(logrotate): remove to_native calls for exception messages

* docs(logrotate): improve `config_dir` param description

* refactor(logrotate): simplify backup file assignment logic

* style(logrotate): format file

* docs(logrotate): improve config_map description

---------



(cherry picked from commit e911081102)

Co-authored-by: tigattack <10629864+tigattack@users.noreply.github.com>
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
2026-04-17 18:32:36 +02:00
..
.keep Rename changelogs/fragments/.empty -> changelogs/fragments/.keep 2020-08-07 08:17:57 +02:00
12.6.0.yml Prepare 12.6.0. 2026-04-08 20:13:58 +02:00
8852-snmp-facts-pysnmp7.yml [PR #11683/5a27cbde backport][stable-12] snmp_facts: update to pysnmp >= 7.1 async API (#11711) 2026-03-30 22:33:30 +02:00
10786-jira-cloud-search.yml [PR #11701/d956fb81 backport][stable-12] jira - add cloud option to support Jira Cloud search endpoint (#11716) 2026-04-01 07:06:25 +02:00
11487-ipa-host-fix-disable.yml [PR #11487/5eaa22b0 backport][stable-12] ipa_host: fix errors when disabling host (#11789) 2026-04-12 13:37:56 +02:00
11664-mssql-named-instance-port.yml [PR #11664/d48a0668 backport][stable-12] mssql_*: named instances (#11672) 2026-03-24 07:00:36 +01:00
11681-pacman-root-cachedir-config.yml [PR #11681/e2c06f2d backport][stable-12] pacman: add root, cachedir, and config options (#11684) 2026-03-26 06:47:20 +01:00
11688-flatpak-fix-runtime-removal.yml [PR #11688/85685944 backport][stable-12] flatpak: fix removal of runtimes (#11713) 2026-03-31 08:06:46 +02:00
11689-composer-create-project-idempotent.yml [PR #11689/a4bba992 backport][stable-12] composer - make create-project idempotent, add force parameter (#11700) 2026-03-27 21:34:35 +01:00
11698-ipa-failed-response.yml [PR #11698/47ef322a backport][stable-12] ipa module utils: detect and fail on errors in API response failed field (#11710) 2026-03-30 21:43:39 +02:00
11717-fix-error-dnsttl.yml [PR #11717/b2cd1b55 backport][stable-12] Fix KeyError for 'dnsttl' (#11736) 2026-04-04 18:44:05 +00:00
11721-xenserver-guest-codeqa.yml [PR #11721/08442186 backport][stable-12] xenserver_guest: fix code style caught by codeqa (#11725) 2026-04-03 07:34:32 +02:00
11728-opendj_backendprop-cmdrunner.yml [PR #11728/2acb20be backport][stable-12] opendj_backendprop: use CmdRunner (#11731) 2026-04-03 15:21:16 +02:00
11733-gem-cmd-runner.yml [PR #11733/6f12d930 backport][stable-12] gem: use CmdRunner (#11791) 2026-04-12 13:38:08 +02:00
11738-run-command-locale-group3-batch1.yml [PR #11738/c90b5046 backport][stable-12] Ensure standard locale in run_command (group3-batch1) (#11739) 2026-04-06 10:05:05 +02:00
11740-run-command-locale-group3-batch2.yml [PR #11740/936ab2ea backport][stable-12] Ensure standard locale in run_command (group3-batch2) (#11755) 2026-04-08 15:34:23 +02:00
11741-run-command-locale-group3-batch3.yml [PR #11741/e59888dd backport][stable-12] Ensure standard locale in run_command (group3-batch3) (#11756) 2026-04-08 15:34:34 +02:00
11742-run-command-locale-nmcli.yml [PR #11742/bdd31745 backport][stable-12] nmcli: use get_best_parsable_locale() to support UTF-8 connection names (#11757) 2026-04-08 15:46:30 +02:00
11748-flatpak-from-url.yml [PR #11748/972bed66 backport][stable-12] flatpak: add from_url parameter, deprecate URLs in name (#11814) 2026-04-13 21:30:31 +02:00
11753-java-cert-proxy-auth.yml [PR #11753/c7deda2e backport][stable-12] java_cert: support proxy authentication from https_proxy env var (#11761) 2026-04-09 06:35:16 +02:00
11754-mssql-script-params-substitution.yml [PR #11754/b780224d backport][stable-12] mssql_script: only pass params to cursor.execute() when provided (#11758) 2026-04-08 20:06:07 +02:00
11764-logrotate-fixes.yml [PR #11764/e9110811 backport][stable-12] logrotate: fix parameter and config file validation and more (#11856) 2026-04-17 18:32:36 +02:00
11765-group4-locale.yml [PR #11765/2297a5c8 backport][stable-12] Ensure standard locale in run_command (group4-batch1) (#11792) 2026-04-12 13:38:43 +02:00
11767-group4-batch2-locale.yml [PR #11767/f4f2bfe8 backport][stable-12] openbsd_pkg, sorcery: ensure standard locale in run_command (group4-batch2) (#11793) 2026-04-12 13:43:30 +02:00
11768-group5-batch1-locale.yml [PR #11768/b40608a3 backport][stable-12] Ensure standard locale in run_command (group5-batch1) (#11795) 2026-04-12 22:29:14 +02:00
11771-incus-machinectl-run0-become-pty.yml [PR #11771/df252e5f backport][stable-12] incus, machinectl, run0 - fix become over pty connections (#11827) 2026-04-15 22:01:06 +02:00
11772-dconf-dbus-broker.yml [PR #11772/24ca7965 backport][stable-12] dconf: add dbus-broker support by improving D-Bus session discovery (#11820) 2026-04-14 22:02:54 +02:00
11773-group5-batch2-locale.yml [PR #11773/8fbb43e6 backport][stable-12] Ensure standard locale in run_command (group5-batch2) (#11806) 2026-04-12 22:29:04 +02:00
11774-group5-batch3-locale.yml [PR #11774/6d5644ac backport][stable-12] Ensure standard locale in run_command (group5-batch3) (#11807) 2026-04-12 22:27:28 +02:00
11775-group5-batch4-locale.yml [PR #11775/7c52f1c4 backport][stable-12] Ensure standard locale in run_command (group5-batch4) (#11808) 2026-04-12 22:27:16 +02:00
11776-group5-batch5-locale.yml [PR #11776/e45e6cbb backport][stable-12] Ensure standard locale in run_command (group5-batch5) (#11809) 2026-04-12 22:27:07 +02:00
11777-group5-batch6-locale.yml [PR #11777/a9d6bb2a backport][stable-12] Ensure standard locale in run_command (group5-batch6) (#11810) 2026-04-12 22:27:00 +02:00
11778-group5-batch7-locale.yml [PR #11778/42a1998b backport][stable-12] Ensure standard locale in run_command (group5-batch7) (#11805) 2026-04-12 22:26:47 +02:00
11779-group5-batch8-locale.yml [PR #11779/d6909578 backport][stable-12] Ensure standard locale in run_command (group5-batch8) (#11804) 2026-04-12 22:28:52 +02:00
11780-group5-batch9-locale.yml [PR #11780/5c6a5999 backport][stable-12] Ensure standard locale in run_command (group5-batch9) (#11803) 2026-04-12 22:28:44 +02:00
11781-group5-batch10-locale.yml [PR #11781/5f0a9bba backport][stable-12] Ensure standard locale in run_command (group5-batch10) (#11802) 2026-04-12 22:28:35 +02:00
11782-group5-batch11-locale.yml [PR #11782/fe9e7284 backport][stable-12] Ensure standard locale in run_command (group5-batch11) (#11801) 2026-04-12 22:28:26 +02:00
11783-group5-batch12-locale.yml [PR #11848/c4ed3467 backport][stable-12] homebrew_tap: fix None in command, redundant brew tap calls, format strings, and drop no-op locale vars (#11865) 2026-04-17 18:32:10 +02:00
11784-group5-batch13-locale.yml [PR #11784/3f7ae199 backport][stable-12] Ensure standard locale in run_command (group5-batch13) (#11799) 2026-04-12 22:28:12 +02:00
11785-group5-batch14-locale.yml [PR #11785/269a5ed8 backport][stable-12] Ensure standard locale in run_command (group5-batch14) (#11797) 2026-04-12 22:28:00 +02:00
11786-group5-batch15-locale.yml [PR #11786/37653bc7 backport][stable-12] Ensure standard locale in run_command (group5-batch15) (#11796) 2026-04-12 22:27:47 +02:00
11787-group5-batch16-locale.yml [PR #11787/95e2b771 backport][stable-12] Ensure standard locale in run_command (group5-batch16) (#11798) 2026-04-12 22:27:35 +02:00
11811-lvm_pv-use-cmdrunner.yml [PR #11811/ff5c34c4 backport][stable-12] lvm_pv - use CmdRunner (#11833) 2026-04-15 22:01:11 +02:00
11823-lvol-lvm-version-regex.yml [PR #11823/71723268 backport][stable-12] lvol: fix LVM version regex to handle date formats without dashes (#11831) 2026-04-15 22:01:28 +02:00
11825-iso-extract-leading-slash.yml [PR #11825/d1448b76 backport][stable-12] iso_extract: strip leading path separator from file entries (#11832) 2026-04-15 22:01:19 +02:00
11836-fixes.yml [PR #11836/ef656cb9 backport][stable-12] CI: Replace Fedora 43 with 44 for devel (#11846) 2026-04-16 22:00:37 +02:00
11837-iso-extract-umount-retry.yml [PR #11837/87ecfa34 backport][stable-12] iso_extract: retry umount on busy filesystem before cleanup (#11857) 2026-04-17 18:32:27 +02:00
11848-homebrew-tap-fixes.yml [PR #11848/c4ed3467 backport][stable-12] homebrew_tap: fix None in command, redundant brew tap calls, format strings, and drop no-op locale vars (#11865) 2026-04-17 18:32:10 +02:00
11850-homebrew-cask-sudo-password.yml [PR #11850/f8869af6 backport][stable-12] homebrew_cask: fix sudo_password failing with special characters (#11867) 2026-04-17 18:31:52 +02:00
11851-gitlab-project-members-ambiguous.yml [PR #11851/1db3d4f4 backport][stable-12] gitlab_project_members: fail when multiple projects match by name (#11864) 2026-04-17 18:32:02 +02:00
11859-udm_user-param-name-fix.yml [PR #11859/dad84dd3 backport][stable-12] udm_user - fix alias-to-canonical param name mismatch (#11863) 2026-04-17 18:32:17 +02:00
11861-etcd3-lookup-https.yml [PR #11861/076bc4e0 backport][stable-12] etcd3 lookup - improve HTTPS connection handling and docs (#11871) 2026-04-17 18:31:39 +02:00
fix-nsupdate-gss-tsig.yml [PR #11712/bd7b361d backport][stable-12] nsupdate: fix GSS-TSIG support (#11790) 2026-04-12 13:37:47 +02:00