diff --git a/ansible_collections/paessler/prtg/plugins/module_utils/prtg_api.py b/ansible_collections/paessler/prtg/plugins/module_utils/prtg_api.py index 92b37905320686fb107c87155d4aedd831ff6ee7..f4dfded20bc20ff5d94d377fcc685cbbc3d2d389 100644 --- a/ansible_collections/paessler/prtg/plugins/module_utils/prtg_api.py +++ b/ansible_collections/paessler/prtg/plugins/module_utils/prtg_api.py @@ -68,7 +68,7 @@ class PRTG_API: except (HTTPError, URLError) as e: raise PRTG_API_Exception( f"PRTG API not available at '{self.appserver_url}' - {e}" - ) + ) from e def device_filter_request_body(self, message=None, duration=None): body = {"filter": f'dnsname = "{self.params["host"]}"'} @@ -98,13 +98,15 @@ class PRTG_API: except HTTPError as e: if e.status == 404: msg = ( - "Couldn't find PRTG device with IPv4 Address/DNS Name '{0}'. " - "Check that the name in your inventory matches the name of the device in PRTG." - ).format(self.params["host"]) + f"Couldn't find PRTG device with the IP Address / \ + DNS Name '{self.params['host']}'. " + "Check that the host name exactly matches the name \ + of the device in PRTG including capitalization." + ) else: msg = f"Couldn't perform PRTG action. PRTG returned: {e}" - raise PRTG_API_Exception(msg) + raise PRTG_API_Exception(msg) from e def device_pause(self): pause_body = self.device_filter_request_body( diff --git a/ansible_collections/paessler/prtg/plugins/modules/device_resume.py b/ansible_collections/paessler/prtg/plugins/modules/device_resume.py index d234bd2d258142832c74336e203f15d30d7c11ba..683d6a9b3a80c2f4376ede6419566fe5702dc9a6 100644 --- a/ansible_collections/paessler/prtg/plugins/modules/device_resume.py +++ b/ansible_collections/paessler/prtg/plugins/modules/device_resume.py @@ -68,8 +68,8 @@ object: type: dict sample: changed: True - resume_success: 1 - resume_failed: 0 + resumed_success: 1 + resumed_failed: 0 """ from ansible.module_utils.basic import AnsibleModule @@ -124,8 +124,8 @@ def run_module(): if summary > 0: if success > 0: ansible_result["changed"] = True - ansible_result["resume_success"] = success - ansible_result["resume_failed"] = failed + ansible_result["resumed_success"] = success + ansible_result["resumed_failed"] = failed # in the event of a successful module execution, you will want to # simple AnsibleModule.exit_json(), passing the key/value results diff --git a/ansible_collections/paessler/prtg/tests/integration/targets/resume/tasks/resume_one_ok_with_api_key.yml b/ansible_collections/paessler/prtg/tests/integration/targets/resume/tasks/resume_one_ok_with_api_key.yml index b73d21ddeb5b2f7c3c1fadddbbc8e6723d618fd8..704cbdd54cf3ed62b46530cf2bd5205a5d99c246 100644 --- a/ansible_collections/paessler/prtg/tests/integration/targets/resume/tasks/resume_one_ok_with_api_key.yml +++ b/ansible_collections/paessler/prtg/tests/integration/targets/resume/tasks/resume_one_ok_with_api_key.yml @@ -19,8 +19,8 @@ that: - result is changed - result is not failed - - result.resume_success == 1 - - result.resume_failed == 0 + - result.resumed_success == 1 + - result.resumed_failed == 0 # TODO paused_success and paused_failed should not be in result # - not "paused_success" in result # - not "paused_failed" in result diff --git a/requirements.txt b/requirements.txt index 7df8d66142e9397f384575c61ad5a2e0d7730415..98a5006ce78baf06035b21ac2d9c41664c1f9d04 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ -ansible-core==2.15.4 -ansible-lint==6.20.1 -ansible==8.4.0 -black==23.9.1 +ansible-core==2.15.11 +ansible-lint==6.22.2 +ansible==10.2.0 +black==24.4.2 connexion==2.14.2 -openapi-spec-validator==0.6.0 +openapi-spec-validator==0.7.1 pylama==8.4.1 -pytest==7.4.2 +pytest==8.3.2