-
Type: Bug
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: 3.6, 3.6.1
-
Component/s: Connection Mgmt
-
None
Seems that SRV support in pymongo doesn't accept lack of a DNS record for hostname itself.
The _get_dns_txt_options function handles a NoAnswer error but doesn't seem to handle the NXDOMAIN error ( http://www.dnspython.org/docs/1.15.0/dns.resolver.NXDOMAIN-class.html ) so when the specified hostname doesn't have a DNS record it crashes with a configuration error:
>>> import pymongo >>> cli = pymongo.MongoClient('mongodb+srv://unstable-mongo.privaws.crunch.io/crunch_app_db_prod?ssl=false&replicaSet=crunch-replica-unstable') <class 'dns.resolver.NXDOMAIN'> Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/var/lib/crunch.io/venv/lib/python2.7/site-packages/pymongo/mongo_client.py", line 468, in __init__ res = uri_parser.parse_uri(entity, port, warn=True) File "/var/lib/crunch.io/venv/lib/python2.7/site-packages/pymongo/uri_parser.py", line 417, in parse_uri dns_options = _get_dns_txt_options(fqdn) File "/var/lib/crunch.io/venv/lib/python2.7/site-packages/pymongo/uri_parser.py", line 302, in _get_dns_txt_options raise ConfigurationError(str(exc)) pymongo.errors.ConfigurationError: None of DNS query names exist: unstable-mongo.privaws.crunch.io., unstable-mongo.privaws.crunch.io.us-west-2.compute.internal., unstable-mongo.privaws.crunch.io.privaws.crunch.io.
The documentation states that the TXT record is optional and doesn't say anyhwere that a record for the hostname itself is required, so this seems to be an error.
- is depended on by
-
PYTHON-1557 Release PyMongo 3.7
- Closed