Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions plugins/lookup/cyberark_ccp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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((
Expand Down Expand Up @@ -181,20 +182,23 @@ 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
})

display.vvvvv(f"url: {url}")
display.vvvvv(f"Request: {http_kwargs}")

resp = http.get(url, **http_kwargs)

try:
resp.raise_for_status()
except Exception as exc:
raise AnsibleError(str(exc))

content = resp.Json().get("Content")
content = resp.json().get("Content")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ouch! pylint doesn't pick this up either. Expensive typo...

if not content:
raise AnsibleError("error trying to retrieve password")

Expand Down