Project

General

Profile

Bug #7407

Illogical defaults in Python bindings: conffile=None loads no config, conffile='' loads config from default path

Added by Florian Haas about 10 years ago. Updated about 10 years ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
-
Target version:
-
% Done:

0%

Source:
Community (user)
Tags:
Backport:
Regression:
No
Severity:
4 - irritation
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

This feels weird:

>>> import rados
>>> c = rados.Rados()
>>> c.connect()
unable to find any monitors in conf. please specify monitors via -m monaddr or -c ceph.conf
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/rados.py", line 367, in connect
    raise make_ex(ret, "error calling connect")
rados.ObjectNotFound: error calling connect
>>> c = rados.Rados(conffile='')
>>> c.connect()
>>> c.state
'connected'

It seems illogical why rados.Rados(conffile=None) (the default) does not read the default config, while rados.Rados(conffile='') does.

History

#1 Updated by Josh Durgin about 10 years ago

  • Priority changed from Normal to Low

The original rationale was to keep the existing behavior (not reading a conf file) and use None as a default value to be consistent with the other default values, I agree it did end up making the interface confusing, but we can't break backwards compatibility. Marking low priority so we can reconsider if the python bindings or librados get a major version bump.

#2 Updated by Florian Haas about 10 years ago

Sure, totally agree on the low priority.

Also available in: Atom PDF