Skip to content

Commit

Permalink
Adding windows requirements - remember to pip install requirements-op…
Browse files Browse the repository at this point in the history
…t.txt

Comment in requirements-opt for pycurl.
  • Loading branch information
truthbk committed Dec 22, 2015
1 parent 0a8a1b6 commit 5e8382a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
20 changes: 20 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,26 @@ def set_win32_cert_path():
log.info("Windows certificate path: %s" % crt_path)
tornado.simple_httpclient._DEFAULT_CA_CERTS = crt_path


def set_win32_requests_ca_bundle_path():
"""In order to allow `requests` to validate SSL requests with the packaged .exe on Windows,
we need to override the default certificate location which is based on the location of the
requests or certifi libraries.
We override the path directly in requests.adapters so that the override works even when the
`requests` lib has already been imported
"""
import requests.adapters
if hasattr(sys, 'frozen'):
# we're frozen - from py2exe
prog_path = os.path.dirname(sys.executable)
ca_bundle_path = os.path.join(prog_path, 'cacert.pem')
requests.adapters.DEFAULT_CA_BUNDLE_PATH = ca_bundle_path

log.info("Default CA bundle path of the requests library: {0}"
.format(requests.adapters.DEFAULT_CA_BUNDLE_PATH))


def get_confd_path(osname=None):
if not osname:
osname = get_os()
Expand Down
2 changes: 2 additions & 0 deletions requirements-opt.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# tornado can work without pycurl and use the simple http client
# but some features won't work, like the abylity to use a proxy
# Require a compiler and the curl headers+lib
# On windows - manual install of pycurl might be easier.
pycurl==7.19.5.1

# core-ish/system -> system check on windows
Expand All @@ -27,6 +28,7 @@ pymongo==2.8
kazoo==1.3.1

# checks.d/ssh_check.py
winrandom-ctypes
# Require a compiler because pycrypto is a dep
paramiko==1.15.2

Expand Down
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@
'pysnmp.entity.rfc3413.oneliner.*',
'pyVim.*',
'pyVmomi.*',
'paramiko',
'Crypto',
'winrandom',

# agent
'checks.network_checks',
Expand Down
1 change: 0 additions & 1 deletion win32/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@
'mesos',
'network',
'postfix',
'ssh_check',
'zk',
]

Expand Down

0 comments on commit 5e8382a

Please sign in to comment.