By running the following, you will gain an interactive interface of the shell. The LMIShell is waiting for the end of an input to quit – by hitting <ctrl+d> you can exit from it:
$ lmishell > <ctrl+d> $
$ lmishell > quit() $
Establish a connection¶
Following examples demonstrate, how to connect to a CIMOM by issuing a connect() call.
Common means of performing the authentication is done by providing a username and password to connect() function. See the following example:
> c = connect("host", "username") password: # <not echoed> >
> c = connect("host", "username", "password") >
LMIShell can connect directly to the CIMOM using Unix socket. For this type of connection, the shell needs to be run under root user and the destination machine has to be either localhost, 127.0.0.1 or ::1. This type of connection is supported by TOG-Pegasus and there needs to be a Unix socket file present at /var/run/tog-pegasus/cimxml.socket. If the condition is not met, classic username/password method will be used.
See following example:
> c = connect("localhost") >
Function connect() returns either LMIConnection object, if the connection can be established, otherwise None is returned. Suppose, the LMIShell is run in verbose mode (-v, --verbose, -m or --more-verbose is used). See following example of creating a connection:
> # correct username or password > c = connect("host", "username", "password") INFO: Connected to host > isinstance(c, LMIConnection) True > # wrong login username or password > c = connect("host", "wrong_username", "wrong_password") ERROR: Error connecting to host, <error message> > c is None True >
NOTE: By default, LMIShell prints out only error messages, when calling a connect(); no INFO messages will be print out. It is possible to suppress all the messages by passing -q or --quiet).
Server’s certificate validation¶
When using https transport protocol, LMIShell tries to validate each server-side certificate against platform provided CA trust store. It is necessary to copy the server’s certificate from each CIMOM to the platform specific trust store directory.
NOTE: It is possible to make LMIShell skip the certificate validation process by lmishell -n or --noverify.
See following example:
$ lmishell --noverify >