Skip to content

Commit

Permalink
Add check for both path and file (#907)
Browse files Browse the repository at this point in the history
  • Loading branch information
hmstepanek authored Aug 21, 2023
1 parent 6a6228f commit 62abb45
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion newrelic/common/agent_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def __init__(

# If there is no resolved cafile, assume the bundled certs are
# required and report this condition as a supportability metric.
if not verify_path.cafile:
if not verify_path.cafile and not verify_path.capath:
ca_bundle_path = certs.where()
internal_metric(
"Supportability/Python/Certificate/BundleRequired", 1
Expand Down
1 change: 1 addition & 0 deletions tests/agent_unittests/test_agent_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@ def test_ca_bundle_path(monkeypatch, ca_bundle_path):
# Pretend CA certificates are not available
class DefaultVerifyPaths(object):
cafile = None
capath = None

def __init__(self, *args, **kwargs):
pass
Expand Down
5 changes: 4 additions & 1 deletion tests/agent_unittests/test_http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def test_http_payload_compression(server, client_cls, method, threshold):
# Verify the compressed payload length is recorded
assert internal_metrics["Supportability/Python/Collector/method1/ZLIB/Bytes"][:2] == [1, payload_byte_len]
assert internal_metrics["Supportability/Python/Collector/ZLIB/Bytes"][:2] == [2, payload_byte_len*2]

assert len(internal_metrics) == 8
else:
# Verify no ZLIB compression metrics were sent
Expand Down Expand Up @@ -366,11 +366,14 @@ def test_cert_path(server):
def test_default_cert_path(monkeypatch, system_certs_available):
if system_certs_available:
cert_file = "foo"
ca_path = "/usr/certs"
else:
cert_file = None
ca_path = None

class DefaultVerifyPaths(object):
cafile = cert_file
capath = ca_path

def __init__(self, *args, **kwargs):
pass
Expand Down

0 comments on commit 62abb45

Please sign in to comment.