command.show

Contains command classes producing key-value pairs to output.

class lmi.scripts.common.command.show.LmiShowInstance(*args, **kwargs)

End point command producing a list of properties of particular CIM instance. Either reduced list of properties to print can be specified, or the associated function alone can decide, which properties shall be printed. Associated function is expected to return CIM instance as a result.

List of additional recognized properties:

DYNAMIC_PROPERTIES : bool

A boolean saying, whether the associated function alone shall specify the list of properties of rendered instance. If True, the result of function must be a pair:

(props, inst)

Where props is the same value as can be passed to PROPERTIES property. Defaults to False.

PROPERTIES : tuple

May contain list of instance properties, that will be produced in the same order as output. Each item of list can be either:

name : str
Name of property to render.
pair : tuple
A tuple (Name, render_func), where former item an arbitraty name for rendered value and the latter is a function taking as the only argument particular instance and returning value to render.

DYNAMIC_PROPERTIES and PROPERTIES are mutually exclusive. If none is given, all instance properties will be printed.

Using metaclass: ShowInstanceMetaClass.

classmethod render(_self, inst)

Return tuple of (column_names, values) ready for output by formatter.

take_action(connection, args, kwargs)

Process single connection to a host, render result and return a value to render.

Returns:List of pairs, where the first item is a label and second a value to render.
Return type:list