summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-08-19 12:48:40 -0700
committerSage Weil <sage@inktank.com>2013-08-19 12:49:49 -0700
commitd348cf5d135d099fe0490c1519196cd83a04831e (patch)
treec32fa461fee0f23aec70c988efaae56dbab111a5
parent290bcd8a718887eb0e28aa2d97bceeee79068ea9 (diff)
downloadceph-d348cf5d135d099fe0490c1519196cd83a04831e.tar.gz
rados pybind: add conf_parse_env()
Signed-off-by: Sage Weil <sage@inktank.com> Reviewed-by: Dan Mick <dan.mick@inktank.com> (cherry picked from commit eef7cacdb19313907a9367187b742db5382ee584)
-rw-r--r--src/pybind/rados.py13
-rw-r--r--src/test/pybind/test_rados.py6
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: