"READD_OPT",
"REBOOT_TYPE_OPT",
"REMOVE_UIDS_OPT",
+ "ROMAN_OPT",
"SECONDARY_IP_OPT",
"SELECT_OS_OPT",
"SEP_OPT",
" ranges separated by commas, to be"
" removed from the user-id pool"))
+ROMAN_OPT = cli_option("--roman",
+ dest="roman_integers", default=False,
+ action="store_true",
+ help="Use roman numbers for positive integers")
+
+
def _ParseArgs(argv, commands, aliases):
"""Parser for the command line arguments.
<arg>--units=<replaceable>UNITS</replaceable></arg>
<arg>-o <replaceable>[+]FIELD,...</replaceable></arg>
<sbr>
+ <arg>--roman</arg>
+ <sbr>
<arg rep="repeat">node</arg>
</cmdsynopsis>
</para>
<para>
+ Passing the <option>--roman</option> option gnt-node list will try to
+ output some of its fields in a latin-friendly way. This is not the
+ default for backwards compatibility.
+ </para>
+
+ <para>
The <option>-o</option> option takes a comma-separated list of
output fields. The available fields and their meaning are:
<variablelist>
import sys
+try:
+ import roman
+except ImportError:
+ roman = None
+
from ganeti.cli import *
from ganeti import opcodes
from ganeti import utils
"pinst_cnt", "sinst_cnt",
"ctotal", "serial_no"]
+ latinfriendlyfields = ["pinst_cnt", "sinst_cnt",
+ "ctotal", "cnodes", "csockets",
+ "serial_no"]
+
list_type_fields = ("pinst_list", "sinst_list", "tags")
# change raw values to nicer strings
for row in output:
val = utils.FormatTime(val)
elif val is None:
val = "?"
+ elif (roman is not None and opts.roman_integers
+ and field in latinfriendlyfields):
+ try:
+ val = roman.toRoman(val)
+ except roman.RomanError:
+ pass
row[idx] = str(val)
data = GenerateTable(separator=opts.separator, headers=headers,
"[<node_name>...]", "Show information about the node(s)"),
'list': (
ListNodes, ARGS_MANY_NODES,
- [NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT, SYNC_OPT],
+ [NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT, SYNC_OPT, ROMAN_OPT],
"[nodes...]",
"Lists the nodes in the cluster. The available fields are (see the man"
" page for details): %s. The default field list is (in order): %s." %