From 355145f866af3f29fa432d6e15def5db7b6e1f7b Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Tue, 8 Oct 2024 17:10:02 +0200 Subject: [PATCH] Rename forwards_events to test_mode to be consistent with the API Signed-off-by: Alina Buzachis --- plugins/modules/event_stream.py | 24 +++++++++++++++---- .../targets/event_stream/tasks/main.yml | 8 +++---- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/plugins/modules/event_stream.py b/plugins/modules/event_stream.py index 85dbbb35..94570ea7 100644 --- a/plugins/modules/event_stream.py +++ b/plugins/modules/event_stream.py @@ -58,12 +58,15 @@ type: str default: '' version_added: 2.1.0 - forward_events: + test_mode: description: - Enable the event stream to forward events to the rulebook activation where it is configured. + - The O(forward_events) alias has been deprecated and will be removed in release 4.0.0. type: bool - default: True + default: true version_added: 2.1.0 + aliases: + - forward_events state: description: - Desired state of the resource. @@ -117,8 +120,8 @@ def create_params(module: AnsibleModule, controller: Controller) -> dict[str, An if module.params.get("event_stream_type"): credential_params["event_stream_type"] = module.params["event_stream_type"] - if module.params.get("forward_events") is not None: - credential_params["test_mode"] = module.params["forward_events"] + if module.params.get("test_mode") is not None: + credential_params["test_mode"] = module.params["test_mode"] if module.params.get("headers"): credential_params["additional_data_headers"] = module.params["headers"] @@ -156,7 +159,18 @@ def main() -> None: organization_name=dict(type="str", aliases=["organization"]), event_stream_type=dict(type="str", aliases=["type"]), headers=dict(type="str", default=""), - forward_events=dict(type="bool", default=True), + test_mode=dict( + type="bool", + default=True, + aliases=["forward_events"], + deprecated_aliases=[ + dict( + name="forward_events", + version="4.0.0", + collection_name="ansible.eda", + ) + ], + ), state=dict(choices=["present", "absent"], default="present"), ) diff --git a/tests/integration/targets/event_stream/tasks/main.yml b/tests/integration/targets/event_stream/tasks/main.yml index e45bd59c..134063b2 100644 --- a/tests/integration/targets/event_stream/tasks/main.yml +++ b/tests/integration/targets/event_stream/tasks/main.yml @@ -46,7 +46,7 @@ name: "{{ event_stream_name }}" credential_name: "{{ credential_name }}" organization_name: Default - forward_events: False + test_mode: false event_stream_type: Basic Event Stream check_mode: true register: _result @@ -133,7 +133,7 @@ that: - _result.event_streams[0].name == new_event_stream_name - - name: Update event stream headers and forward_events + - name: Update event stream headers and test_mode ansible.eda.event_stream: state: present name: "{{ new_event_stream_name }}" @@ -141,7 +141,7 @@ organization_name: Default event_stream_type: "Basic Event Stream" headers: "Authorization,Custom-Header" - forward_events: False + test_mode: false register: _result - name: Check event stream is updated @@ -154,7 +154,7 @@ name: "{{ new_event_stream_name }}" register: _result - - name: Check if event stream headers and forward_events are updated + - name: Check if event stream headers and test_mode are updated assert: that: - _result.event_streams[0].name == new_event_stream_name