From 722c48b9901b1235bfe9a168a9bdfebe90d20b4c Mon Sep 17 00:00:00 2001 From: $GITHUB_ACTOR Date: Mon, 18 Nov 2024 10:13:14 -0500 Subject: [PATCH 1/3] added addition cyberark logging --- plugins/lookup/cyberark_ccp.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/lookup/cyberark_ccp.py b/plugins/lookup/cyberark_ccp.py index 96ccefd..edf6da6 100644 --- a/plugins/lookup/cyberark_ccp.py +++ b/plugins/lookup/cyberark_ccp.py @@ -111,6 +111,7 @@ from ansible.plugins.lookup import LookupBase from ansible_collections.itential.core.plugins.module_utils import http +from ansible_collections.itential.core.plugins.module_utils import display PARAMETERS = frozenset(( @@ -187,6 +188,9 @@ def run(self, terms, variables, **kwargs): "private_key_file": private_key_file }) + display.vvvvv(f"url: {http_kwargs}") + display.vvvvv(f"Request: {http_kwargs}") + resp = http.get(url, **http_kwargs) try: From 4252249052d08917e4b7eea7a682e2a0ff7f5e43 Mon Sep 17 00:00:00 2001 From: $GITHUB_ACTOR Date: Mon, 18 Nov 2024 12:59:08 -0500 Subject: [PATCH 2/3] fixed url --- plugins/lookup/cyberark_ccp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/lookup/cyberark_ccp.py b/plugins/lookup/cyberark_ccp.py index edf6da6..7db6a40 100644 --- a/plugins/lookup/cyberark_ccp.py +++ b/plugins/lookup/cyberark_ccp.py @@ -188,9 +188,9 @@ def run(self, terms, variables, **kwargs): "private_key_file": private_key_file }) - display.vvvvv(f"url: {http_kwargs}") + display.vvvvv(f"url: {url}") display.vvvvv(f"Request: {http_kwargs}") - + resp = http.get(url, **http_kwargs) try: From 32d6d25638784a6a63615fa89bc1e35125d0c1ee Mon Sep 17 00:00:00 2001 From: $GITHUB_ACTOR Date: Thu, 21 Nov 2024 10:18:31 -0500 Subject: [PATCH 3/3] fixed response casting and private key file conditional --- plugins/lookup/cyberark_ccp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/lookup/cyberark_ccp.py b/plugins/lookup/cyberark_ccp.py index 7db6a40..a3017ea 100644 --- a/plugins/lookup/cyberark_ccp.py +++ b/plugins/lookup/cyberark_ccp.py @@ -182,7 +182,7 @@ def run(self, terms, variables, **kwargs): certificate_file = kwargs.get("certificate_file") private_key_file = kwargs.get("private_key_file") - if certificate_file is not None and private_key_file is None: + if certificate_file is not None and private_key_file is not None: http_kwargs.update({ "certificate_file": certificate_file, "private_key_file": private_key_file @@ -198,7 +198,7 @@ def run(self, terms, variables, **kwargs): except Exception as exc: raise AnsibleError(str(exc)) - content = resp.Json().get("Content") + content = resp.json().get("Content") if not content: raise AnsibleError("error trying to retrieve password")