]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind: catch EntityAddress missing /
authorLoic Dachary <loic@dachary.org>
Sun, 15 Sep 2013 14:40:25 +0000 (16:40 +0200)
committerLoic Dachary <loic@dachary.org>
Mon, 23 Sep 2013 21:46:43 +0000 (23:46 +0200)
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>
src/pybind/ceph_argparse.py

index 427a4621216a53d3c595e19be8e7a0f77a98f353..f115d3791af886398752e2b3839f61861496d676 100644 (file)
@@ -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