From 4de7de3ce9b92a546832edd8e8af97c20a4d2a0a Mon Sep 17 00:00:00 2001 From: John Westcott IV Date: Fri, 5 Jun 2020 13:29:37 -0400 Subject: [PATCH] Prevent exception for Non value --- awx_collection/plugins/modules/tower_settings.py | 4 ++++ .../tests/integration/targets/tower_settings/tasks/main.yml | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/awx_collection/plugins/modules/tower_settings.py b/awx_collection/plugins/modules/tower_settings.py index b7ecde45ef..a66acadf44 100644 --- a/awx_collection/plugins/modules/tower_settings.py +++ b/awx_collection/plugins/modules/tower_settings.py @@ -82,6 +82,10 @@ except ImportError: def coerce_type(module, value): + # If our value is already None we can just return directly + if value == None: + return value + yaml_ish = bool(( value.startswith('{') and value.endswith('}') ) or ( diff --git a/awx_collection/tests/integration/targets/tower_settings/tasks/main.yml b/awx_collection/tests/integration/targets/tower_settings/tasks/main.yml index a02ca673de..6cebe979e2 100644 --- a/awx_collection/tests/integration/targets/tower_settings/tasks/main.yml +++ b/awx_collection/tests/integration/targets/tower_settings/tasks/main.yml @@ -74,3 +74,9 @@ - assert: that: - "result is changed" + +- name: Handle an omit value + tower_settings: + name: AWX_PROOT_BASE_PATH + value: '{{ junk_var | default(omit) }}' +