This module defines LmiCheckResult command class and related utilities.
- class lmi.scripts.common.command.checkresult.LmiCheckResult(*args, **kwargs)¶
Run an associated action and check its result. It implicitly makes no output if the invocation is successful and expected result matches.
List of additional recognized properties:
- EXPECT :
Value, that is expected to be returned by invoked associated function. This can also be a callable taking two arguments:
- options - Dictionary with parsed command line options returned by docopt.
- result - Return value of associated function.
Using metaclass: CheckResultMetaClass.
- check_result(options, result)¶
Check the returned value of associated function.
- options (dictionary) – Dictionary as returned by docopt parser after running transform_options().
- result – Any return value that will be compared against what is expected.
Whether the result is expected value or not. If tuple is returned, it contains (passed_flag, error_description).
boolean or tuple.
- take_action(connection, args, kwargs)¶
Invoke associated method and check its return value for single host.
- args (list) – List of arguments to pass to the associated function.
- kwargs (dictionary) – Keyword arguments to pass to the associated function.
Exit code (0 on success).