LMIShellClient¶
- class lmi.shell.LMIShellClient.LMIShellClient(uri, username='', password='', interactive=False, use_cache=True, key_file=None, cert_file=None, verify_server_cert=True)[source]¶
LMIShellClient overrides few methods due to caching purposes.
Parameters: - uri (string) – URI of the CIMOM
- username (string) – account, under which, the CIM calls will be performed
- password (string) – user’s password
- interactive (bool) – flag indicating, if the LMIShell client is running in the interactive mode; default value is False.
- use_cache (bool) – flag indicating, if the LMIShell client should use cache for CIMClass objects. This saves a lot’s of communication, if there is often the LMIShellClient.get_class_names() or LMIShellClient.attr.get_class() call issued.
- key_file (string) – path to x509 key file; default value is None
- cert_file (string) – path to x509 cert file; default value is None
- verify_server_cert (bool) – indicates, whether a server side certificate needs to be verified, if SSL used; default value is True
NOTE: If interactive is set to True, LMIShell will:
- prompt for username and password, if missing and connection via Unix socket can not be established.
- use pager for the output of: LMIInstance.doc(), LMIClass.doc(), LMIInstance.tomof() and LMIMethod.tomof()
- cache[source]¶
Returns: LMIShell’s cache Return type: LMIShellCache
- get_class(classname, namespace=None, LocalOnly=True, IncludeQualifiers=True, IncludeClassOrigin=False, PropertyList=None, full_fetch=False)[source]¶
Returns a wbem.CIMClass object.
Parameters: - classname (string) – class name
- namespace (string) – – namespace name, from which the wbem.CIMClass should be retrieved; if None, default namespace will be used (NOTE: see wbem)
- LocalOnly (bool) – indicates, if only local members should be present in the returned wbem.CIMClass; any CIM elements (properties, methods, and qualifiers), except those added or overridden in the class as specified in the classname input parameter, shall not be included in the returned class.
- IncludeQualifiers (bool) – indicates, if qualifiers for the class (including qualifiers on the class and on any returned properties, methods, or method parameters) shall be included in the response.
- IncludeClassOrigin (bool) – indicates, if the CLASSORIGIN attribute shall be present on all appropriate elements in the returned class.
- PropertyList (list) – if present and not None, the members of the list define one or more property names. The returned class shall not include elements for properties missing from this list. Note that if LocalOnly is specified as True, it acts as an additional filter on the set of properties returned. For example, if property A is included in the PropertyList but LocalOnly is set to True and A is not local to the requested class, it is not included in the response. If the PropertyList input parameter is an empty list, no properties are included in the response. If the PropertyList input parameter is None, no additional filtering is defined.
Returns: LMIReturnValue object with rval set to wbem.CIMClass, if no error occurs; otherwise rval is set to none and errorstr to appropriate error string
Raises:
- get_class_names(namespace=None, ClassName=None, DeepInheritance=False)[source]¶
Returns a list of class names.
Parameters: - namespace (string) – namespace, from which the class names list should be retrieved; if None, default namespace will be used (NOTE: see wbem)
- ClassName (string) – defines the class that is the basis for the enumeration. If the ClassName input parameter is absent, this implies that the names of all classes.
- DeepInheritance (bool) – if not present, of False, only the names of immediate child subclasses are returned, otherwise the names of all subclasses of the specified class should be returned.
Returns: LMIReturnValue object with rval set to a list of strings containing class names, if no error occurs; otherwise rval is set to None and errorstr contains an appropriate error string
Raises:
- get_superclass(classname, namespace=None)[source]¶
Returns string of a superclass to given class, if such superclass exists, None otherwise.
Parameters: - classname (string) – class name
- namespace (string) – namespace name
Returns: superclass name to a given classname or None
Raises: CIMError, ConnectionError