From 591e212c27037879e16ea8e3157bfa95e497db9c Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 11 Oct 2024 15:27:54 +0200 Subject: [PATCH] fix: remove event_stream_type for event_stream module (#339) Signed-off-by: Alex --- plugins/modules/event_stream.py | 16 +++++++++++----- .../targets/activation/tasks/main.yml | 1 - .../targets/event_stream/tasks/main.yml | 6 ------ 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/plugins/modules/event_stream.py b/plugins/modules/event_stream.py index bfe954a8..73daaf6b 100644 --- a/plugins/modules/event_stream.py +++ b/plugins/modules/event_stream.py @@ -48,6 +48,8 @@ event_stream_type: description: - Type of the event stream. + - This field is not necessary to create an event stream and will be ignored. + - This field will be removed in version 3.0.0. type: str aliases: - type @@ -114,9 +116,6 @@ def create_params(module: AnsibleModule, controller: Controller) -> dict[str, Any]: credential_params: dict[str, Any] = {} - 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: if module.params["forward_events"]: credential_params["test_mode"] = False @@ -157,10 +156,16 @@ def main() -> None: new_name=dict(type="str"), credential_name=dict(type="str", aliases=["credential"]), 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=False), state=dict(choices=["present", "absent"], default="present"), + # fix: event_stream_type is not used in the module + event_stream_type=dict( + type="str", + aliases=["type"], + removed_in_version="3.0.0", + removed_from_collection="ansible.eda", + ), ) argument_spec.update(AUTH_ARGSPEC) @@ -169,7 +174,7 @@ def main() -> None: ( "state", "present", - ("name", "credential_name", "organization_name", "event_stream_type"), + ("name", "credential_name", "organization_name"), ) ] @@ -206,6 +211,7 @@ def main() -> None: new_name = module.params.get("new_name") # Attempt to look up event stream based on the provided name + event_stream = {} try: event_stream = controller.get_exactly_one(event_stream_endpoint, name=name) except EDAError as e: diff --git a/tests/integration/targets/activation/tasks/main.yml b/tests/integration/targets/activation/tasks/main.yml index aa16cb4a..a65cf01d 100644 --- a/tests/integration/targets/activation/tasks/main.yml +++ b/tests/integration/targets/activation/tasks/main.yml @@ -225,7 +225,6 @@ name: "{{ event_stream_name }}" credential_name: "{{ credential_name_basic }}" organization_name: Default - event_stream_type: "basic" register: _result - name: Get information about a rulebook diff --git a/tests/integration/targets/event_stream/tasks/main.yml b/tests/integration/targets/event_stream/tasks/main.yml index 61b60173..aee1dfd9 100644 --- a/tests/integration/targets/event_stream/tasks/main.yml +++ b/tests/integration/targets/event_stream/tasks/main.yml @@ -47,7 +47,6 @@ credential_name: "{{ credential_name }}" organization_name: Default forward_events: false - event_stream_type: "basic" check_mode: true register: _result @@ -62,7 +61,6 @@ name: "{{ event_stream_name }}" credential_name: "{{ credential_name }}" organization_name: Default - event_stream_type: "basic" register: _result - name: Check event stream is created @@ -76,7 +74,6 @@ name: "{{ event_stream_name }}" credential_name: "{{ credential_name }}" organization_name: Default - event_stream_type: "basic" register: _result - name: Check event stream is not created again @@ -95,7 +92,6 @@ name: "{{ new_event_stream_name }}" credential_name: "{{ credential_name }}" organization_name: Default - event_stream_type: "basic" register: _result - name: Check event stream update @@ -109,7 +105,6 @@ name: "{{ new_event_stream_name }}" credential_name: "{{ credential_name }}" organization_name: Default - event_stream_type: "basic" register: _result - name: Check event stream is not updated again @@ -133,7 +128,6 @@ name: "{{ new_event_stream_name }}" credential_name: "{{ credential_name }}" organization_name: Default - event_stream_type: "basic" headers: "Authorization,Custom-Header" forward_events: true register: _result