Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if param flag values are defined, not truthiness #366

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions plugins/modules/rulebook_activation.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,13 +412,13 @@ def create_params(
if module.params.get("restart_policy"):
activation_params["restart_policy"] = module.params["restart_policy"]

if module.params.get("enabled"):
if module.params.get("enabled") is not None:
activation_params["is_enabled"] = module.params["enabled"]

if not is_aap_24 and module.params.get("log_level"):
activation_params["log_level"] = module.params["log_level"]

if not is_aap_24 and module.params.get("swap_single_source"):
if not is_aap_24 and module.params.get("swap_single_source") is not None:
activation_params["swap_single_source"] = module.params["swap_single_source"]

return activation_params
Expand Down
12 changes: 12 additions & 0 deletions tests/integration/targets/activation/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,12 @@
- name: Get information about the rulebook activation
ansible.eda.rulebook_activation_info:
name: "{{ activation_name }}"
register: _result_activation_info

- name: Assert that rulebook activation is disabled
ansible.builtin.assert:
that:
- not _result_activation_info.activations[0].is_enabled

- name: List all the rulebook activations
ansible.eda.rulebook_activation_info:
Expand Down Expand Up @@ -380,6 +386,7 @@
enabled: False
awx_token_name: "{{ awx_token_name }}"
organization_name: Default
swap_single_source: False
event_streams:
- event_stream: "{{ event_stream_name }}"
source_name: "{{ _result_rulebook_info.rulebooks[0].sources[0].name }}"
Expand All @@ -404,6 +411,11 @@
that:
- event_stream_name in (source_mappings_dict | map(attribute='event_stream_name') | list)

- name: Assert that swap single source flag is disabled
ansible.builtin.assert:
that:
- not _result_activation_info.activations[0].swap_single_source
Copy link
Contributor

@Alex-Izquierdo Alex-Izquierdo Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this assertion, it is a feature of the collection for configuring event streams. not a field in the backend, rest LGTM


- name: Delete project
ansible.eda.project:
name: "{{ project_name }}"
Expand Down
Loading