salt.output.table_out

Display output in a table format

New in version 2017.7.0.

The table outputter displays a sequence of rows as table.

Example output:

edge01.bjm01:
----------
    comment:
    ----------
    out:
    ----------
        ______________________________________________________________________________
        | Active | Interface | Last Move |        Mac        | Moves | Static | Vlan |
        ______________________________________________________________________________
        |  True  |  ae1.900  |    0.0    | 40:A6:77:5A:50:01 |   0   | False  | 111  |
        ______________________________________________________________________________
        |  True  |  ae1.111  |    0.0    | 64:16:8D:32:26:58 |   0   | False  | 111  |
        ______________________________________________________________________________
        |  True  |  ae1.111  |    0.0    | 8C:60:4F:73:2D:57 |   0   | False  | 111  |
        ______________________________________________________________________________
        |  True  |  ae1.111  |    0.0    | 8C:60:4F:73:2D:7C |   0   | False  | 111  |
        ______________________________________________________________________________
        |  True  |  ae1.222  |    0.0    | 8C:60:4F:73:2D:57 |   0   | False  | 222  |
        ______________________________________________________________________________
        |  True  |  ae1.222  |    0.0    | F4:0F:1B:76:9D:97 |   0   | False  | 222  |
        ______________________________________________________________________________
    result:
    ----------

CLI Example:

salt '*' foo.bar --out=table
class salt.output.table_out.TableDisplay(has_header=True, row_delimiter='-', delim=' | ', justify='center', separate_rows=True, prefix='| ', suffix=' |', width=50, wrapfunc=None)

Manage the table display content.

display(ret, indent, out, rows_key=None, labels_key=None)

Display table(s).

display_rows(rows, labels, indent)

Prepares row content and displays.

prepare_rows(rows, indent, has_header)

Prepare rows content to be displayed.

ustring(indent, color, msg, prefix='', suffix='', endc=None)

Build the unicode string to be displayed.

wrap_onspace(text)

When the text inside the column is longer then the width, will split by space and continue on the next line.

salt.output.table_out.output(ret, **kwargs)

Display the output as table.

Parameters:
  • nested_indent (*) -- integer, specify the left alignment.

  • has_header (*) -- boolean specifying if header should be displayed. Default: True.

  • row_delimiter (*) -- character to separate rows. Default: _.

  • delim (*) -- character to separate columns. Default: " | ".

  • justify (*) -- text alignment. Default: center.

  • separate_rows (*) -- boolean specifying if row separator will be displayed between consecutive rows. Default: True.

  • prefix (*) -- character at the beginning of the row. Default: "| ".

  • suffix (*) -- character at the end of the row. Default: " |".

  • width (*) -- column max width. Default: 50.

  • rows_key (*) -- display the rows under a specific key.

  • labels_key (*) -- use the labels under a certain key. Otherwise will try to use the dictionary keys (if any).

  • title (*) -- display title when only one table is selected (using the rows_key argument).