Revision a24aed2a lib/client/gnt_cluster.py

b/lib/client/gnt_cluster.py
52 52
                    action="store_true", dest="groups",
53 53
                    help="Arguments are node groups instead of nodes")
54 54

  
55
SHOW_MACHINE_OPT = cli_option("-M", "--show-machine-names", default=False,
56
                              action="store_true",
57
                              help="Show machine name for every line in output")
58

  
55 59
_EPO_PING_INTERVAL = 30 # 30 seconds between pings
56 60
_EPO_PING_TIMEOUT = 1 # 1 second
57 61
_EPO_REACHABLE_TIMEOUT = 15 * 60 # 15 minutes
......
529 533
  for name in nodes:
530 534
    result = srun.Run(name, "root", command)
531 535
    ToStdout("------------------------------------------------")
532
    ToStdout("node: %s", name)
533
    ToStdout("%s", result.output)
536
    if opts.show_machine_names:
537
      for line in result.output.splitlines():
538
        ToStdout("%s: %s", name, line)
539
    else:
540
      ToStdout("node: %s", name)
541
      ToStdout("%s", result.output)
534 542
    ToStdout("return code = %s", result.exit_code)
535 543

  
536 544
  return 0
......
1500 1508
    "[-n node...] <filename>", "Copies a file to all (or only some) nodes"),
1501 1509
  "command": (
1502 1510
    RunClusterCommand, [ArgCommand(min=1)],
1503
    [NODE_LIST_OPT, NODEGROUP_OPT],
1511
    [NODE_LIST_OPT, NODEGROUP_OPT, SHOW_MACHINE_OPT],
1504 1512
    "[-n node...] <command>", "Runs a command on all (or only some) nodes"),
1505 1513
  "info": (
1506 1514
    ShowClusterConfig, ARGS_NONE, [ROMAN_OPT],

Also available in: Unified diff