-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set inventory plugin insecure if no cafile defined #58
Conversation
In Tower 3.7, I was running into an issue with a self signed certificate on my RHV cluster. Disabling secure connections when the cafile is not defined fixes this issue, in the same way that it worked in previous versions of Tower with the ovirt4 inventory plugin.
Hello contributor, thanks for submitting a PR for this project! I am the bot who triggers "standard-CI" builds for this project. In order to allow automated tests to run, please ask one of the project maintainers to review the code and then do one of the following:
|
Hi @seansackowitz, this is a bit gray area I have talked about it with the creator of this plugin in [1]. [1] https://github.com/ansible/ansible/pull/49085/files#r377061353 |
While I do agree with the points brought up in that discussion, I still find that the overall experience as a user is failing to meet expectations. And by that I mean, when using the provided RHV credential type in Tower, which doesn't require the ca to be specified, but doesn't allow you to set OVIRT_INSECURE, you are unable to utilize the provided inventory source for ovirt, as it is requiring the ca file by default, and there is no option to override that requirement. So, I see two solutions:
|
@seansackowitz good point that it breaks backwards compatibility with the older plugin and user cannot edit it. |
plugins/inventory/ovirt.py
Outdated
@@ -244,7 +244,7 @@ def parse(self, inventory, loader, path, cache=True): | |||
username=self.get_option('ovirt_username'), | |||
password=self.get_option('ovirt_password'), | |||
ca_file=self.get_option('ovirt_cafile'), | |||
insecure=self.get_option('ovirt_insecure'), | |||
insecure=not self.get_option('ovirt_cafile'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about to use insecure when specified and if not default to cafile?
insecure=self.get_option('ovirt_insecure') if self.get_option('ovirt_insecure') is not None else not self.get_option('ovirt_cafile')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tested your suggestion, but it appears that ovirt_insecure is being defaulted to false somewhere else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a little bit of investigation and the default value is added in the DOCUMENTATION.
I removed the default value and worked as it should.
ovirt-ansible-collection/plugins/inventory/ovirt.py
Lines 47 to 50 in 44e9c32
ovirt_insecure: | |
description: A boolean flag that indicates if the server TLS certificate and host name should be checked. | |
required: False | |
default: False |
If I recall correctly, default variables are set by specifying it in doc_fragments. I initially followed the philosophy of the SDK where Please think about updating the documentation too as this change has an impact on the plugins behaviour. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
In Tower 3.7, I was running into an issue with a self signed certificate on my RHV cluster. Disabling secure connections when the cafile is not defined fixes this issue, in the same way that it worked in previous versions of Tower with the ovirt4 inventory plugin.