From 8e43dee5df683b1f3e9ca3d347d78f26e390722a Mon Sep 17 00:00:00 2001 From: Shane Harvey Date: Mon, 12 Aug 2019 12:09:57 -0700 Subject: [PATCH] PYTHON-1957 Don't use unix sockets for mongocryptd client --- pymongo/encryption_options.py | 11 ++--------- test/test_encryption.py | 10 +--------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/pymongo/encryption_options.py b/pymongo/encryption_options.py index d6d2d619b..537c13ca3 100644 --- a/pymongo/encryption_options.py +++ b/pymongo/encryption_options.py @@ -15,7 +15,6 @@ """Options to configure client side encryption.""" import copy -import socket try: import pymongocrypt @@ -32,7 +31,7 @@ class AutoEncryptionOpts(object): def __init__(self, kms_providers, key_vault_namespace, key_vault_client=None, schema_map=None, bypass_auto_encryption=False, - mongocryptd_uri=None, + mongocryptd_uri='mongodb://localhost:27020', mongocryptd_bypass_spawn=False, mongocryptd_spawn_path='mongocryptd', mongocryptd_spawn_args=None): @@ -90,8 +89,7 @@ class AutoEncryptionOpts(object): enabled. Defaults to ``False``. - `mongocryptd_uri` (optional): The MongoDB URI used to connect to the *local* mongocryptd process. Defaults to - ``"mongodb://%2Ftmp%2Fmongocryptd.sock"`` if domain sockets are - available or ``"mongodb://localhost:27020"`` otherwise. + ``'mongodb://localhost:27020'``. - `mongocryptd_bypass_spawn` (optional): If ``True``, the encrypted MongoClient will not attempt to spawn the mongocryptd process. Defaults to ``False``. @@ -117,11 +115,6 @@ class AutoEncryptionOpts(object): self._key_vault_client = key_vault_client self._schema_map = schema_map self._bypass_auto_encryption = bypass_auto_encryption - if mongocryptd_uri is None: - if hasattr(socket, 'AF_UNIX'): - mongocryptd_uri = 'mongodb://%2Ftmp%2Fmongocryptd.sock' - else: - mongocryptd_uri = 'mongodb://localhost:27020' self._mongocryptd_uri = mongocryptd_uri self._mongocryptd_bypass_spawn = mongocryptd_bypass_spawn self._mongocryptd_spawn_path = mongocryptd_spawn_path diff --git a/test/test_encryption.py b/test/test_encryption.py index 014daf24d..f718c7436 100644 --- a/test/test_encryption.py +++ b/test/test_encryption.py @@ -17,7 +17,6 @@ import base64 import copy import os -import socket import traceback import sys import uuid @@ -74,14 +73,7 @@ class TestAutoEncryptionOpts(PyMongoTestCase): self.assertEqual(opts._key_vault_client, None) self.assertEqual(opts._schema_map, None) self.assertEqual(opts._bypass_auto_encryption, False) - - if hasattr(socket, 'AF_UNIX'): - self.assertEqual( - opts._mongocryptd_uri, 'mongodb://%2Ftmp%2Fmongocryptd.sock') - else: - self.assertEqual( - opts._mongocryptd_uri, 'mongodb://localhost:27020') - + self.assertEqual(opts._mongocryptd_uri, 'mongodb://localhost:27020') self.assertEqual(opts._mongocryptd_bypass_spawn, False) self.assertEqual(opts._mongocryptd_spawn_path, 'mongocryptd') self.assertEqual(