From: Greg Farnum Date: Wed, 25 Sep 2013 22:55:10 +0000 (-0700) Subject: mon: don't list "--yes-i-really-mean-it" options as required X-Git-Tag: v0.71~71^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F606%2Fhead;p=ceph.git mon: don't list "--yes-i-really-mean-it" options as required By default options are required, and that leads to the Ceph CLI making users add this to their commands before even submitting it to the monitor. We want them to see and think about the messages generated by the monitor! Signed-off-by: Greg Farnum Signed-off-by: Loic Dachary --- diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h index f13bd8d2685..752745a0c22 100644 --- a/src/mon/MonCommands.h +++ b/src/mon/MonCommands.h @@ -210,8 +210,8 @@ COMMAND("quorum_status", "report status of monitor quorum", \ "mon", "r", "cli,rest") COMMAND("mon_status", "report status of monitors", "mon", "r", "cli,rest") COMMAND("sync force " \ - "name=validate1,type=CephChoices,strings=--yes-i-really-mean-it " \ - "name=validate2,type=CephChoices,strings=--i-know-what-i-am-doing", \ + "name=validate1,type=CephChoices,strings=--yes-i-really-mean-it,req=false " \ + "name=validate2,type=CephChoices,strings=--i-know-what-i-am-doing,req=false", \ "force sync of and clear monitor store", "mon", "rw", "cli,rest") COMMAND("heap " \ "name=heapcmd,type=CephChoices,strings=dump|start_profiler|stop_profiler|release|stats", \ @@ -292,7 +292,7 @@ COMMAND("mds remove_data_pool " \ COMMAND("mds newfs " \ "name=metadata,type=CephInt,range=0 " \ "name=data,type=CephInt,range=0 " \ - "name=sure,type=CephChoices,strings=--yes-i-really-mean-it", \ + "name=sure,type=CephChoices,strings=--yes-i-really-mean-it,req=false", \ "make new filesystom using pools and ", \ "mds", "rw", "cli,rest") /* @@ -465,7 +465,7 @@ COMMAND("osd reweight " \ "reweight osd to 0.0 < < 1.0", "osd", "rw", "cli,rest") COMMAND("osd lost " \ "name=id,type=CephInt,range=0 " \ - "name=sure,type=CephChoices,strings=--yes-i-really-mean-it", \ + "name=sure,type=CephChoices,strings=--yes-i-really-mean-it,req=false", \ "mark osd as permanently lost. THIS DESTROYS DATA IF NO MORE REPLICAS EXIST, BE CAREFUL", \ "osd", "rw", "cli,rest") COMMAND("osd create " \ @@ -493,9 +493,9 @@ COMMAND("osd pool create " \ "create pool", "osd", "rw", "cli,rest") COMMAND("osd pool delete " \ "name=pool,type=CephPoolname " \ - "name=pool2,type=CephPoolname " \ - "name=sure,type=CephChoices,strings=--yes-i-really-really-mean-it", \ - "delete pool (say pool twice, add --yes-i-really-really-mean-it)", \ + "name=pool2,type=CephPoolname,req=false " \ + "name=sure,type=CephChoices,strings=--yes-i-really-really-mean-it,req=false", \ + "delete pool", \ "osd", "rw", "cli,rest") COMMAND("osd pool rename " \ "name=srcpool,type=CephPoolname " \ diff --git a/src/test/pybind/test_ceph_argparse.py b/src/test/pybind/test_ceph_argparse.py index 14cbaf50c24..fe7c9bacccc 100755 --- a/src/test/pybind/test_ceph_argparse.py +++ b/src/test/pybind/test_ceph_argparse.py @@ -290,12 +290,12 @@ class TestMonitor(TestArgparse): 'force', '--yes-i-really-mean-it', '--i-know-what-i-am-doing']) + self.assert_valid_command(['sync', + 'force', + '--yes-i-really-mean-it']) + self.assert_valid_command(['sync', + 'force']) assert_equal({}, validate_command(sigdict, ['sync'])) - assert_equal({}, validate_command(sigdict, ['sync', - 'force'])) - assert_equal({}, validate_command(sigdict, ['sync', - 'force', - '--yes-i-really-mean-it'])) assert_equal({}, validate_command(sigdict, ['sync', 'force', '--yes-i-really-mean-it', @@ -468,11 +468,9 @@ class TestMDS(TestArgparse): def test_newfs(self): self.assert_valid_command(['mds', 'newfs', '1', '2', '--yes-i-really-mean-it']) + self.assert_valid_command(['mds', 'newfs', '1', '2']) assert_equal({}, validate_command(sigdict, ['mds', 'newfs'])) assert_equal({}, validate_command(sigdict, ['mds', 'newfs', '1'])) - assert_equal({}, validate_command(sigdict, ['mds', 'newfs', '1', '1'])) - assert_equal({}, validate_command(sigdict, ['mds', 'newfs', '1', '1', - 'no I dont'])) assert_equal({}, validate_command(sigdict, ['mds', 'newfs', '1', @@ -809,9 +807,8 @@ class TestOSD(TestArgparse): def test_lost(self): self.assert_valid_command(['osd', 'lost', '1', '--yes-i-really-mean-it']) + self.assert_valid_command(['osd', 'lost', '1']) assert_equal({}, validate_command(sigdict, ['osd', 'lost'])) - assert_equal({}, validate_command(sigdict, ['osd', 'lost', - '1'])) assert_equal({}, validate_command(sigdict, ['osd', 'lost', '1', 'what?'])) @@ -898,11 +895,11 @@ class TestOSD(TestArgparse): self.assert_valid_command(['osd', 'pool', 'delete', 'poolname', 'poolname', '--yes-i-really-really-mean-it']) + self.assert_valid_command(['osd', 'pool', 'delete', + 'poolname', 'poolname']) + self.assert_valid_command(['osd', 'pool', 'delete', + 'poolname']) assert_equal({}, validate_command(sigdict, ['osd', 'pool', 'delete'])) - assert_equal({}, validate_command(sigdict, ['osd', 'pool', 'delete', - 'poolname'])) - assert_equal({}, validate_command(sigdict, ['osd', 'pool', 'delete', - 'poolname', 'poolname'])) assert_equal({}, validate_command(sigdict, ['osd', 'pool', 'delete', 'poolname', 'poolname', 'not really']))