diff options
author | kurokobo <kuro664@gmail.com> | 2023-09-30 06:02:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-30 06:02:10 +0200 |
commit | 05582702c6f4c671b7579cf5430b95e5f4916150 (patch) | |
tree | 9d81f6bf6f1ed161b659025b69106dd3db8d5fe8 /awx_collection | |
parent | Add a section for postgres max_connections value (#14482) (diff) | |
download | awx-05582702c6f4c671b7579cf5430b95e5f4916150.tar.xz awx-05582702c6f4c671b7579cf5430b95e5f4916150.zip |
fix: make type conversions work correctly (related #14487) (#14489)
Signed-off-by: kurokobo <2920259+kurokobo@users.noreply.github.com>
Co-authored-by: Alan Rominger <arominge@redhat.com>
Diffstat (limited to 'awx_collection')
-rw-r--r-- | awx_collection/plugins/modules/settings.py | 2 | ||||
-rw-r--r-- | awx_collection/tests/integration/targets/settings/tasks/main.yml | 38 |
2 files changed, 39 insertions, 1 deletions
diff --git a/awx_collection/plugins/modules/settings.py b/awx_collection/plugins/modules/settings.py index 56c0b94e5a..c911f77fcc 100644 --- a/awx_collection/plugins/modules/settings.py +++ b/awx_collection/plugins/modules/settings.py @@ -89,7 +89,7 @@ def coerce_type(module, value): if not HAS_YAML: module.fail_json(msg="yaml is not installed, try 'pip install pyyaml'") return yaml.safe_load(value) - elif value.lower in ('true', 'false', 't', 'f'): + elif value.lower() in ('true', 'false', 't', 'f'): return {'t': True, 'f': False}[value[0].lower()] try: return int(value) diff --git a/awx_collection/tests/integration/targets/settings/tasks/main.yml b/awx_collection/tests/integration/targets/settings/tasks/main.yml index 65ae45c639..5feb9ee800 100644 --- a/awx_collection/tests/integration/targets/settings/tasks/main.yml +++ b/awx_collection/tests/integration/targets/settings/tasks/main.yml @@ -1,4 +1,42 @@ --- +- name: Initialize starting project vvv setting to false + awx.awx.settings: + name: "PROJECT_UPDATE_VVV" + value: false + +- name: Change project vvv setting to true + awx.awx.settings: + name: "PROJECT_UPDATE_VVV" + value: true + register: result + +- name: Changing setting to true should have changed the value + assert: + that: + - "result is changed" + +- name: Change project vvv setting to true + awx.awx.settings: + name: "PROJECT_UPDATE_VVV" + value: true + register: result + +- name: Changing setting to true again should not change the value + assert: + that: + - "result is not changed" + +- name: Change project vvv setting back to false + awx.awx.settings: + name: "PROJECT_UPDATE_VVV" + value: false + register: result + +- name: Changing setting back to false should have changed the value + assert: + that: + - "result is changed" + - name: Set the value of AWX_ISOLATION_SHOW_PATHS to a baseline settings: name: AWX_ISOLATION_SHOW_PATHS |