xebialabs-community / xlr-xlrelease-plugin

Create and start another XL Release template from a parent template
MIT License
3 stars 14 forks source link

Fix certifi dependency when ssl-verification is enabled #28

Closed pwillemse closed 6 years ago

pwillemse commented 6 years ago

When ssl-verification is enabled, the following ERROR raised:

Exception during execution:
requests.exceptions.SSLError: [Errno 2] No such file or directory: '__pyclasspath__/certifi/cacert.pem' in <script> at line number 44

By running jython -m pip i nstall requests I got a list of dependencies. The plugin is tested and works fine with the changes

brhahlen commented 6 years ago

Hi @jdewinne I have reviewed this and it looks good to me. Can you do the final check? I can merge it, if needed.

pwillemse commented 6 years ago

From my point of view your suggestion to add some "magic lines" in init.py will not be a sustainable solution, because:

  1. Newer versions of requests lib will do a "from certifi import where" in file certs.py. So a certifi module is required (Older versions have a try/except)
  2. Why adding proprietary code in init while the libs should take of that?
  3. The latest version of requests module will not load its dependencies

When you really suggest to add the environment variable in init, why isn't it added before? Now 2.2.0 is broken.

We found the error because the task from xlr-xlrelease was the first one, so no other tasks where loaded.

jdewinne commented 6 years ago

I've just tried with the additional libs, and I'm receiving the same error when executing a test connection towards a XLR instance that has ssl enabled with a self signed certificate.

Can't connect to XL Release: Server.
requests.exceptions.SSLError: [Errno 2] No such file or directory: '__pyclasspath__/certifi/cacert.pem'

It might be that the additional dependencies are needed for another reason, but they don't seem to solve the original problem as described. At this point adding the mentioned snippet in __init__.py would only be a workaround. And as every plugin that uses requests seems to be needing that, I agree we should work towards a more generic solution.

Can you describe why those 5 additional libraries are needed, and why we can't for example go with the requests lib that is already part of the xlr-xld-plugin and by default installed?

pwillemse commented 6 years ago

I started some investigation, and I understand the workaround in the init.py. I try to find what is going on on a lower level and why it sometimes seems to work or not. It would be nice to work towards a better solution. I will add code in init.py

pwillemse commented 6 years ago

A new pull request is created, I will close this one