mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-03 20:54:24 -07:00
[PR #10445/1f8b5eea backport][stable-10] cronvar: Handle empty value string properly (#10495)
Some checks are pending
EOL CI / EOL Sanity (Ⓐ2.15) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.15+py2.7) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.15+py3.10) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.15+py3.5) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/3/) (push) Waiting to run
nox / Run extra sanity tests (push) Waiting to run
Some checks are pending
EOL CI / EOL Sanity (Ⓐ2.15) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.15+py2.7) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.15+py3.10) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.15+py3.5) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/3/) (push) Waiting to run
nox / Run extra sanity tests (push) Waiting to run
cronvar: Handle empty value string properly (#10445)
* Fix empty value issue in cronvar
* Update changelog
* Update plugins/modules/cronvar.py
* Update changelogs/fragments/10445-cronvar-reject-empty-values.yml
* Update tests/integration/targets/cronvar/tasks/main.yml
* Update tests/integration/targets/cronvar/tasks/main.yml
* Accept empty strings on cronvar
* Update plugins/modules/cronvar.py
* Update main.yml
---------
(cherry picked from commit 1f8b5eea4c
)
Co-authored-by: Giorgos Drosos <56369797+gdrosos@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
94d33854b3
commit
c8360e7d1a
3 changed files with 21 additions and 0 deletions
|
@ -123,6 +123,23 @@
|
|||
- custom_varcheck2.stdout == '1'
|
||||
- custom_varcheck3.stdout == '0'
|
||||
|
||||
|
||||
- name: Add variable with empty string
|
||||
community.general.cronvar:
|
||||
name: EMPTY_VAR
|
||||
value: ""
|
||||
state: present
|
||||
|
||||
- name: Assert empty var present
|
||||
ansible.builtin.shell: crontab -l
|
||||
register: result
|
||||
changed_when: false
|
||||
|
||||
- name: Assert line is quoted
|
||||
ansible.builtin.assert:
|
||||
that: >-
|
||||
'EMPTY_VAR=""' in result.stdout
|
||||
|
||||
- name: Attempt to add cron variable to non-existent parent directory
|
||||
cronvar:
|
||||
name: NOPARENT_VAR
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue