diff options
author | Sage Weil <sage@inktank.com> | 2013-08-19 12:48:40 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-08-19 12:48:58 -0700 |
commit | eef7cacdb19313907a9367187b742db5382ee584 (patch) | |
tree | b7615df906e4ff559d9efc91dfc1d3e6d7dfdc0c | |
parent | 68c1c70e1fdec7a916272695f2dcc27b0b65e9fc (diff) | |
download | ceph-eef7cacdb19313907a9367187b742db5382ee584.tar.gz |
rados pybind: add conf_parse_env()
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Dan Mick <dan.mick@inktank.com>
-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: |