Skip to content

Commit 62abb45

Browse files
authored
Add check for both path and file (#907)
1 parent 6a6228f commit 62abb45

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

newrelic/common/agent_http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def __init__(
263263

264264
# If there is no resolved cafile, assume the bundled certs are
265265
# required and report this condition as a supportability metric.
266-
if not verify_path.cafile:
266+
if not verify_path.cafile and not verify_path.capath:
267267
ca_bundle_path = certs.where()
268268
internal_metric(
269269
"Supportability/Python/Certificate/BundleRequired", 1

tests/agent_unittests/test_agent_protocol.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,7 @@ def test_ca_bundle_path(monkeypatch, ca_bundle_path):
565565
# Pretend CA certificates are not available
566566
class DefaultVerifyPaths(object):
567567
cafile = None
568+
capath = None
568569

569570
def __init__(self, *args, **kwargs):
570571
pass

tests/agent_unittests/test_http_client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def test_http_payload_compression(server, client_cls, method, threshold):
325325
# Verify the compressed payload length is recorded
326326
assert internal_metrics["Supportability/Python/Collector/method1/ZLIB/Bytes"][:2] == [1, payload_byte_len]
327327
assert internal_metrics["Supportability/Python/Collector/ZLIB/Bytes"][:2] == [2, payload_byte_len*2]
328-
328+
329329
assert len(internal_metrics) == 8
330330
else:
331331
# Verify no ZLIB compression metrics were sent
@@ -366,11 +366,14 @@ def test_cert_path(server):
366366
def test_default_cert_path(monkeypatch, system_certs_available):
367367
if system_certs_available:
368368
cert_file = "foo"
369+
ca_path = "/usr/certs"
369370
else:
370371
cert_file = None
372+
ca_path = None
371373

372374
class DefaultVerifyPaths(object):
373375
cafile = cert_file
376+
capath = ca_path
374377

375378
def __init__(self, *args, **kwargs):
376379
pass

0 commit comments

Comments
 (0)