Revision 771734c9

b/lib/cli.py
54 54
  "DISKIDX_OPT",
55 55
  "DISK_OPT",
56 56
  "DISK_TEMPLATE_OPT",
57
  "DRAINED_OPT",
57 58
  "FIELDS_OPT",
58 59
  "FILESTORE_DIR_OPT",
59 60
  "FILESTORE_DRIVER_OPT",
......
65 66
  "IGNORE_FAILURES_OPT",
66 67
  "IGNORE_SIZE_OPT",
67 68
  "FORCE_OPT",
69
  "MC_OPT",
68 70
  "NET_OPT",
69 71
  "NEW_SECONDARY_OPT",
70 72
  "NODE_LIST_OPT",
......
78 80
  "NWSYNC_OPT",
79 81
  "ON_PRIMARY_OPT",
80 82
  "ON_SECONDARY_OPT",
83
  "OFFLINE_OPT",
81 84
  "OS_OPT",
82 85
  "OS_SIZE_OPT",
83 86
  "READD_OPT",
......
453 456
cli_option = CliOption
454 457

  
455 458

  
459
_YESNO = ("yes", "no")
460
_YORNO = "yes|no"
461

  
456 462
DEBUG_OPT = cli_option("-d", "--debug", default=False,
457 463
                       action="store_true",
458 464
                       help="Turn debugging on")
......
692 698
                                help="Disable SSH key fingerprint checking")
693 699

  
694 700

  
701
MC_OPT = cli_option("-C", "--master-candidate", dest="master_candidate",
702
                    choices=_YESNO, default=None, metavar=_YORNO,
703
                    help="Set the master_candidate flag on the node")
704

  
705
OFFLINE_OPT = cli_option("-O", "--offline", dest="offline", metavar=_YORNO,
706
                         choices=_YESNO, default=None,
707
                         help="Set the offline flag on the node")
708

  
709
DRAINED_OPT = cli_option("-D", "--drained", dest="drained", metavar=_YORNO,
710
                         choices=_YESNO, default=None,
711
                         help="Set the drained flag on the node")
712

  
713

  
695 714
def _ParseArgs(argv, commands, aliases):
696 715
  """Parser for the command line arguments.
697 716

  
b/scripts/gnt-node
656 656
           (", ".join(_LIST_HEADERS), ", ".join(_LIST_DEF_FIELDS))),
657 657
  'modify': (SetNodeParams, ARGS_ONE_NODE,
658 658
             [DEBUG_OPT, FORCE_OPT,
659
              SUBMIT_OPT,
660
              cli_option("-C", "--master-candidate", dest="master_candidate",
661
                         choices=('yes', 'no'), default=None,
662
                         metavar="yes|no",
663
                         help="Set the master_candidate flag on the node"),
664
              cli_option("-O", "--offline", dest="offline", metavar="yes|no",
665
                         choices=('yes', 'no'), default=None,
666
                         help="Set the offline flag on the node"),
667
              cli_option("-D", "--drained", dest="drained", metavar="yes|no",
668
                         choices=('yes', 'no'), default=None,
669
                         help="Set the drained flag on the node"),
670
              ],
659
              SUBMIT_OPT, MC_OPT, DRAINED_OPT, OFFLINE_OPT],
671 660
             "<node_name>", "Alters the parameters of a node"),
672 661
  'powercycle': (PowercycleNode, ARGS_ONE_NODE,
673 662
                 [DEBUG_OPT, FORCE_OPT, CONFIRM_OPT],

Also available in: Unified diff