Revision 31d97b2a scripts/gnt-node

b/scripts/gnt-node
28 28

  
29 29
import sys
30 30

  
31
try:
32
  import roman
33
except ImportError:
34
  roman = None
35

  
31 36
from ganeti.cli import *
32 37
from ganeti import opcodes
33 38
from ganeti import utils
......
207 212
               "pinst_cnt", "sinst_cnt",
208 213
               "ctotal", "serial_no"]
209 214

  
215
  latinfriendlyfields = ["pinst_cnt", "sinst_cnt",
216
                         "ctotal", "cnodes", "csockets",
217
                         "serial_no"]
218

  
210 219
  list_type_fields = ("pinst_list", "sinst_list", "tags")
211 220
  # change raw values to nicer strings
212 221
  for row in output:
......
223 232
        val = utils.FormatTime(val)
224 233
      elif val is None:
225 234
        val = "?"
235
      elif (roman is not None and opts.roman_integers
236
            and field in latinfriendlyfields):
237
        try:
238
          val = roman.toRoman(val)
239
        except roman.RomanError:
240
          pass
226 241
      row[idx] = str(val)
227 242

  
228 243
  data = GenerateTable(separator=opts.separator, headers=headers,
......
662 677
    "[<node_name>...]", "Show information about the node(s)"),
663 678
  'list': (
664 679
    ListNodes, ARGS_MANY_NODES,
665
    [NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT, SYNC_OPT],
680
    [NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT, SYNC_OPT, ROMAN_OPT],
666 681
    "[nodes...]",
667 682
    "Lists the nodes in the cluster. The available fields are (see the man"
668 683
    " page for details): %s. The default field list is (in order): %s." %

Also available in: Unified diff