Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-842

Unable to specify 'ssl_cert_reqs' option using URI style connection string

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.0, 2.8.1
    • Affects Version/s: None
    • Component/s: None
    • None

      When using following connection string

      mongodb://127.0.0.1/database?ssl_cert_reqs=2
      

      an exception is raised

        File "/opt/ampli/apps/marvintaskmgr/venv/lib/python2.7/site-packages/pymongo/uri_parser.py", line 308, in parse_uri
          options = split_options(opts)
        File "/opt/ampli/apps/marvintaskmgr/venv/lib/python2.7/site-packages/pymongo/uri_parser.py", line 211, in split_options
          return validate_options(options)
        File "/opt/ampli/apps/marvintaskmgr/venv/lib/python2.7/site-packages/pymongo/uri_parser.py", line 153, in validate_options
          option, value = validate(option, value)
        File "/opt/ampli/apps/marvintaskmgr/venv/lib/python2.7/site-packages/pymongo/common.py", line 351, in validate
          value = validator(option, value)
        File "/opt/ampli/apps/marvintaskmgr/venv/lib/python2.7/site-packages/pymongo/common.py", line 133, in validate_cert_reqs
          "`ssl.CERT_REQUIRED" % (option,))
      ConfigurationError: The value of ssl_cert_reqs must be one of: `ssl.CERT_NONE`, `ssl.CERT_OPTIONAL` or `ssl.CERT_REQUIRED
      

      ssl_cert_reqs validator only allows (ssl.CERT_NONE, ssl.CERT_OPTIONAL, ssl.CERT_REQUIRED) or (0, 1, 2) while the value is a string.

      Suggest to allow 'CERT_NONE', 'CERT_OPTIONAL' and 'CERT_REQUIRED' as options for ssl_cert_reqs
      https://github.com/mongodb/mongo-python-driver/blob/v2.8/pymongo/common.py#L126-L131

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            lenbuckens Len Buckens
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: