Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on May 9, 2020. It is now read-only.

Replace urllib2 with requests, add option to disable SSL cert verification #39

Merged
merged 2 commits into from
Sep 10, 2015

Conversation

cread
Copy link
Contributor

@cread cread commented Aug 31, 2015

We have problems with our internally hosted chef server's SSL cert not being real, which is fine for us not facing the internet. Trying to disable validation with urllib2 is quite messy, so this patch:

  • Replaces urllib2 with requests, which cleans things up nicely
  • Adds an option to autoconfigure() that allows users to disable SSL certificate verification

@@ -70,6 +56,8 @@ class ChefAPI(object):
env_value_re = re.compile(r'ENV\[(.+)\]')
ruby_string_re = re.compile(r'^\s*(["\'])(.*?)\1\s*$')

verify_ssl = True
Copy link
Owner

Choose a reason for hiding this comment

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

Please set the in the initialize. Using class MRO callback for default instance values is a really bad pattern.

@cread
Copy link
Contributor Author

cread commented Sep 10, 2015

My second commit brings everything in line with the comments. I've been running this quite happily now for over a week in my production environment.

Anything else required to merge this? Adding PR #37 fixes the tests on my local branch.

@coderanger
Copy link
Owner

Looks good, thanky!

coderanger added a commit that referenced this pull request Sep 10, 2015
Replace urllib2 with requests, add option to disable SSL cert verification
@coderanger coderanger merged commit 5270648 into coderanger:master Sep 10, 2015
@cread
Copy link
Contributor Author

cread commented Sep 10, 2015

Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants