summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Dachary <loic@dachary.org>2013-09-15 16:40:25 +0200
committerGary Lowell <gary.lowell@inktank.com>2013-10-09 10:04:51 -0700
commit49d9e1522eb06261f799ec484eefa6f05f4b8337 (patch)
treee5608a91290da10a2569b3561b7b0c36dc50711f
parent20312b785a12c20fb90b9acf0bf9531b3c5120fb (diff)
downloadceph-49d9e1522eb06261f799ec484eefa6f05f4b8337.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/ceph_argparse.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/pybind/ceph-argparse/ceph_argparse.py b/src/pybind/ceph-argparse/ceph_argparse.py
index 427a4621216..f115d3791af 100644
--- a/src/pybind/ceph-argparse/ceph_argparse.py
+++ b/src/pybind/ceph-argparse/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