Revision 3a5ba66a scripts/gnt-node

b/scripts/gnt-node
379 379
  @return: the desired exit code
380 380

  
381 381
  """
382
  if opts.master_candidate is None:
382
  if opts.master_candidate is None and opts.offline is None:
383 383
    ToStderr("Please give at least one of the parameters.")
384 384
    return 1
385 385

  
386
  candidate = opts.master_candidate == 'yes'
386
  if opts.master_candidate is not None:
387
    candidate = opts.master_candidate == 'yes'
388
  else:
389
    candidate = None
390
  if opts.offline is not None:
391
    offline = opts.offline == 'yes'
392
  else:
393
    offline = None
387 394
  op = opcodes.OpSetNodeParams(node_name=args[0],
388
                              master_candidate=candidate,
389
                              force=opts.force)
395
                               master_candidate=candidate,
396
                               offline=offline,
397
                               force=opts.force)
390 398

  
391 399
  # even if here we process the result, we allow submit only
392 400
  result = SubmitOrSend(op, opts)
......
444 452
              make_option("-C", "--master-candidate", dest="master_candidate",
445 453
                          choices=('yes', 'no'), default=None,
446 454
                          help="Set the master_candidate flag on the node"),
455
              make_option("-O", "--offline", dest="offline",
456
                          choices=('yes', 'no'), default=None,
457
                          help="Set the offline flag on the node"),
447 458
              ],
448 459
             "<instance>", "Alters the parameters of an instance"),
449 460
  'remove': (RemoveNode, ARGS_ONE, [DEBUG_OPT],

Also available in: Unified diff