From 34f6d645dd6157cda8c9239e9336479afa01af47 Mon Sep 17 00:00:00 2001
From: Zach LeBlanc <zjleblanc3@gmail.com>
Date: Wed, 27 Nov 2024 12:35:27 -0600
Subject: [PATCH 1/5] Check if param flag values are defined, not truthiness

---
 plugins/modules/rulebook_activation.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/plugins/modules/rulebook_activation.py b/plugins/modules/rulebook_activation.py
index 9212ac8e..d5170ade 100644
--- a/plugins/modules/rulebook_activation.py
+++ b/plugins/modules/rulebook_activation.py
@@ -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

From de7715a73000863e752c36677e13e09826ff66dc Mon Sep 17 00:00:00 2001
From: Zachary LeBlanc <zjleblanc3@gmail.com>
Date: Mon, 16 Dec 2024 16:26:16 +0000
Subject: [PATCH 2/5] add check in integration tests to verify disabled state

---
 tests/integration/targets/activation/tasks/main.yml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/integration/targets/activation/tasks/main.yml b/tests/integration/targets/activation/tasks/main.yml
index 6c94e461..2f84d5c9 100644
--- a/tests/integration/targets/activation/tasks/main.yml
+++ b/tests/integration/targets/activation/tasks/main.yml
@@ -269,6 +269,11 @@
     - 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:

From f844a84220857dc6c702cceb5427abe1b0d368c8 Mon Sep 17 00:00:00 2001
From: Zachary LeBlanc <zjleblanc3@gmail.com>
Date: Mon, 16 Dec 2024 16:34:48 +0000
Subject: [PATCH 3/5] add test for swap_single_source flag

---
 tests/integration/targets/activation/tasks/main.yml | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tests/integration/targets/activation/tasks/main.yml b/tests/integration/targets/activation/tasks/main.yml
index 2f84d5c9..0265b213 100644
--- a/tests/integration/targets/activation/tasks/main.yml
+++ b/tests/integration/targets/activation/tasks/main.yml
@@ -273,7 +273,8 @@
 
     - name: Assert that rulebook activation is disabled
       ansible.builtin.assert:
-        that: not _result_activation_info.activations[0].is_enabled
+        that: 
+          - not _result_activation_info.activations[0].is_enabled
 
     - name: List all the rulebook activations
       ansible.eda.rulebook_activation_info:
@@ -385,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 }}"
@@ -409,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
+
     - name: Delete project
       ansible.eda.project:
         name: "{{ project_name }}"

From 92b67020994a06f098c876681df7b1a3820f94b7 Mon Sep 17 00:00:00 2001
From: "pre-commit-ci[bot]"
 <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date: Mon, 16 Dec 2024 16:36:07 +0000
Subject: [PATCH 4/5] chore: auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
---
 tests/integration/targets/activation/tasks/main.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/integration/targets/activation/tasks/main.yml b/tests/integration/targets/activation/tasks/main.yml
index 0265b213..2cae5f86 100644
--- a/tests/integration/targets/activation/tasks/main.yml
+++ b/tests/integration/targets/activation/tasks/main.yml
@@ -273,7 +273,7 @@
 
     - name: Assert that rulebook activation is disabled
       ansible.builtin.assert:
-        that: 
+        that:
           - not _result_activation_info.activations[0].is_enabled
 
     - name: List all the rulebook activations
@@ -413,7 +413,7 @@
 
     - name: Assert that swap single source flag is disabled
       ansible.builtin.assert:
-        that: 
+        that:
           - not _result_activation_info.activations[0].swap_single_source
 
     - name: Delete project

From a083da9ca53edd672aebac252dd192661e06a91e Mon Sep 17 00:00:00 2001
From: Zachary LeBlanc <zjleblanc3@gmail.com>
Date: Wed, 18 Dec 2024 16:13:20 +0000
Subject: [PATCH 5/5] merge

---
 tests/integration/targets/activation/tasks/main.yml | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/tests/integration/targets/activation/tasks/main.yml b/tests/integration/targets/activation/tasks/main.yml
index 2cae5f86..28ef6755 100644
--- a/tests/integration/targets/activation/tasks/main.yml
+++ b/tests/integration/targets/activation/tasks/main.yml
@@ -411,11 +411,6 @@
         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
-
     - name: Delete project
       ansible.eda.project:
         name: "{{ project_name }}"