Comment 5 for bug 1632538

Revision history for this message
Diana Clarke (diana-clarke) wrote :

If it were an issue with max_length, I would expect to see an error message like the following: "Value 'https://rdo-ci-fx2-06-s5.v103.rdoci.lab.eng.rdu.redhat.com:13696' exceeds maximum length 10".

- Happy path (no max length)

>>> uri_type = types.URI()
>>> uri_type('https://rdo-ci-fx2-06-s5.v103.rdoci.lab.eng.rdu.redhat.com:13696')
'https://rdo-ci-fx2-06-s5.v103.rdoci.lab.eng.rdu.redhat.com:13696'

- Happy path (large max length)

>>> uri_type = types.URI(max_length=1000)
>>> uri_type('https://rdo-ci-fx2-06-s5.v103.rdoci.lab.eng.rdu.redhat.com:13696')
'https://rdo-ci-fx2-06-s5.v103.rdoci.lab.eng.rdu.redhat.com:13696'

- Error path (exceeds max length)

>>> uri_type = types.URI(max_length=10)
>>> uri_type('https://rdo-ci-fx2-06-s5.v103.rdoci.lab.eng.rdu.redhat.com:13696')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<truncated>/python2.7/site-packages/oslo_config/types.py", line 724, in __call__
    (value, self.max_length))
ValueError: Value 'https://rdo-ci-fx2-06-s5.v103.rdoci.lab.eng.rdu.redhat.com:13696' exceeds maximum length 10

Instead that error message appears to be coming from here, but it's not obvious to me what error condition it's hitting in rfc3986.

https://github.com/openstack/oslo.config/blob/4a691931f378109fd9e1ec97bff0f26dde591e89/oslo_config/types.py#L781

I tried various versions of rfc3986, but I can't reproduce an error with that uri.

$ python
>>> import rfc3986
>>> rfc3986.is_valid_uri('https://rdo-ci-fx2-06-s5.v103.rdoci.lab.eng.rdu.redhat.com:13696', require_scheme=True, require_authority=True)
True

Can you perhaps attach an example config file that causes this error?

Extra whitespace would cause an error message like that one, but whitespace doesn't appear to be the issue based on the trace provided.

>>> uri_type(' https://rdo-ci-fx2-06-s5.v103.rdoci.lab.eng.rdu.redhat.com:13696')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<runcated>/python2.7/site-packages/oslo_config/types.py", line 720, in __call__
    raise ValueError('invalid URI: %r' % value)
ValueError: invalid URI: ' https://rdo-ci-fx2-06-s5.v103.rdoci.lab.eng.rdu.redhat.com:13696'

I'll keep looking, but those are my first-pass, quick thoughts.