cyberark/ansible-conjur-collection

Initialize validate_certs option at lookup start

orenbm opened this issue · 0 comments

The validate_certs option was initialized only if the cert_file was
present so in case a user used the validate_certs option without
cert_file they would get a exceptions.UnboundLocalError error.

Summary

In case a user sets validate_certs to false and doesn't set the variable cert_file (which makes sense when we don't want to validate certs) they will get an exceptions.UnboundLocalError error. This happens because the validate_certs option was initialized only if the cert_file is
present, instead of at the lookup startup.

Steps to Reproduce

Steps to reproduce the behavior:

  1. set validate_certs to false in the playbook.
  2. do not set a value for cert_file.
  3. run the playbook with the lookup plugin.

Expected Results

The lookup plugin works and doesn't validate the certs.

Actual Results (including error logs, if applicable)

An exceptions.UnboundLocalError error is raised.