mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-03-26 21:33:12 +00:00
cronvar: Handle empty value string properly (#10445)
* Fix empty value issue in cronvar * Update changelog * Update plugins/modules/cronvar.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update changelogs/fragments/10445-cronvar-reject-empty-values.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update tests/integration/targets/cronvar/tasks/main.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update tests/integration/targets/cronvar/tasks/main.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Accept empty strings on cronvar * Update plugins/modules/cronvar.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update main.yml Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
@@ -396,6 +396,8 @@ def main():
|
||||
old_value = cronvar.find_variable(name)
|
||||
|
||||
if ensure_present:
|
||||
if value == "" and old_value != "":
|
||||
value = '""'
|
||||
if old_value is None:
|
||||
cronvar.add_variable(name, value, insertbefore, insertafter)
|
||||
changed = True
|
||||
|
||||
Reference in New Issue
Block a user