summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Dachary <loic@dachary.org>2013-09-15 16:40:25 +0200
committerLoic Dachary <loic@dachary.org>2013-09-23 23:46:43 +0200
commitf9c7bc697ce99479ecbcb47571e416ceb53d6bf3 (patch)
tree53ded148aa7df198871ef0326ea1909dd5ec2323
parentccf2200841d84c9b61297ccc482cad95fec1ff8c (diff)
downloadceph-f9c7bc697ce99479ecbcb47571e416ceb53d6bf3.tar.gz
pybind: catch EntityAddress missing /
If the / is missing in an EntityAddress, an ArgumentValid exception must be raised so that it can be caught in the same way other argument validation exceptions are. http://tracker.ceph.com/issues/6274 refs #6274 Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com> Signed-off-by: Loic Dachary <loic@dachary.org>
-rw-r--r--src/pybind/ceph_argparse.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/pybind/ceph_argparse.py b/src/pybind/ceph_argparse.py
index 427a4621216..f115d3791af 100644
--- a/src/pybind/ceph_argparse.py
+++ b/src/pybind/ceph_argparse.py
@@ -278,7 +278,10 @@ class CephEntityAddr(CephIPAddr):
EntityAddress, that is, IP address/nonce
"""
def valid(self, s, partial=False):
- ip, nonce = s.split('/')
+ try:
+ ip, nonce = s.split('/')
+ except:
+ raise ArgumentValid('{0} must contain a /'.format(s))
super(self.__class__, self).valid(ip)
self.nonce = nonce
self.val = s