diff options
-rw-r--r-- | src/pybind/rados.py | 13 | ||||
-rw-r--r-- | src/test/pybind/test_rados.py | 6 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/pybind/rados.py b/src/pybind/rados.py index 7768f8c39d3..a0e5bf42ba9 100644 --- a/src/pybind/rados.py +++ b/src/pybind/rados.py @@ -294,6 +294,19 @@ Rados object in state %s." % (self.state)) retargs = [a for a in cretargs if a is not None] return retargs + def conf_parse_env(self, var='CEPH_ARGS'): + """ + Parse known arguments from an environment variable, normally + CEPH_ARGS. + """ + self.require_state("configuring", "connected") + if not var: + return + ret = run_in_thread(self.librados.rados_conf_parse_env, + (self.cluster, c_char_p(var))) + if (ret != 0): + raise make_ex(ret, "error calling conf_parse_env") + def conf_get(self, option): """ Get the value of a configuration option diff --git a/src/test/pybind/test_rados.py b/src/test/pybind/test_rados.py index 4628a44a652..a8df299c879 100644 --- a/src/test/pybind/test_rados.py +++ b/src/test/pybind/test_rados.py @@ -31,6 +31,12 @@ def test_rados_init(): with Rados(conffile='', name='client.admin'): pass +def test_rados_parse_conf(): + with Rados(conffile='', rados_id='admin') as rados: + rados.parse_env() + rados.parse_env('FOO_DOES_NOT_EXIST_BLAHBLAH') + pass + def test_ioctx_context_manager(): with Rados(conffile='', rados_id='admin') as conn: with conn.open_ioctx('data') as ioctx: |