]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
[RM-12150] Enforce 1 host only for 'mon add' via argparse
authorTravis Rhoden <trhoden@redhat.com>
Wed, 1 Jul 2015 20:11:02 +0000 (13:11 -0700)
committerTravis Rhoden <trhoden@redhat.com>
Mon, 6 Jul 2015 16:39:36 +0000 (09:39 -0700)
Signed-off-by: Travis Rhoden <trhoden@redhat.com>
ceph_deploy/mon.py
ceph_deploy/tests/parser/test_mon.py

index 2e2bffb5ad7dbaed5485447e80db979a012762e0..ab46574de417bc2bd6ed372a4a6a266a78cb888c 100644 (file)
@@ -172,10 +172,7 @@ def concatenate_keyrings(args):
 def mon_add(args):
     cfg = conf.ceph.load(args)
 
-    if not args.mon:
-        raise exc.NeedHostError()
-    elif len(args.mon) > 1:
-        raise exc.GenericError('Only one node can be added at a time')
+    # args.mon is a list with only one entry
     mon_host = args.mon[0]
 
     try:
@@ -475,7 +472,7 @@ def make(parser):
     )
     mon_add.add_argument(
         'mon',
-        nargs='*',
+        nargs=1,
     )
 
     mon_create = mon_parser.add_parser(
index bece63481eca3fe3b41dead4658ce879e1a82994..00ec1cfb80dd488737e6b33dfb3dadf0b6b5f694 100644 (file)
@@ -93,7 +93,6 @@ class TestParserMON(object):
         args = self.parser.parse_args('mon add test1 --address 10.10.0.1'.split())
         assert args.address == '10.10.0.1'
 
-    @pytest.mark.skipif(reason="http://tracker.ceph.com/issues/12150")
     def test_mon_add_no_host_raises_err(self):
         with pytest.raises(SystemExit):
             self.parser.parse_args('mon add'.split())
@@ -102,7 +101,6 @@ class TestParserMON(object):
         args = self.parser.parse_args('mon add test1'.split())
         assert args.mon == ["test1"]
 
-    @pytest.mark.skipif(reason="http://tracker.ceph.com/issues/12150")
     def test_mon_add_multi_host_raises_err(self):
         with pytest.raises(SystemExit):
             self.parser.parse_args('mon add test1 test2'.split())