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

make debconf compare apples to apples (booleans) (#53331)

hope to fix #25481
This commit is contained in:
Brian Coca 2019-03-05 16:03:54 -05:00 committed by GitHub
parent 8136e2e4fe
commit 949ddb48c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- Fix how debconf handles boolean questions to accurately compare

View file

@ -87,6 +87,7 @@ EXAMPLES = r'''
name: tzdata name: tzdata
''' '''
from ansible.module_utils._text import to_text
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
@ -151,7 +152,16 @@ def main():
if vtype is None or value is None: if vtype is None or value is None:
module.fail_json(msg="when supplying a question you must supply a valid vtype and value") module.fail_json(msg="when supplying a question you must supply a valid vtype and value")
if question not in prev or prev[question] != value: # if question doesn't exist, value cannot match
if question not in prev:
changed = True
else:
# ensure we compare booleans supplied to the way debconf sees them (true/false strings)
if vtype == 'boolean':
value = to_text(value).lower()
existing = to_text(prev[question]).lower()
if value != existing:
changed = True changed = True
if changed: if changed: