8. MOF compiler

The language in which CIM classes, CIM Instances, etc. are specified, is called MOF (for Managed Object Format). It is defined in DSP0004.

MOF compilers take MOF files as input, compile them and use the result (CIM classes, instances, and/or qualifier declarations) to update a target CIM repository. The repository may initially be empty, or may contain CIM classes, instances, and/or qualifier declarations that are used to resolve dependencies the new MOF compilation may have.

The pywbem package includes a MOF compiler that is provided in two forms:

  • as an API (described in this chapter)

  • as a command (described in section mof_compiler)

The pywbem MOF compiler will compile MOF files whose syntax complies with DSP0004, with some limitations:

  1. Although there is no formal keyword list of illegal words for property/parameter.etc. names , there is a list of mof syntax tokens in DSP0004 section A.3. Generally these should not be used as property names. The pywbem MOF compiler largely enforces this so that words like ‘indication’ are not allowed as property/parameter/etc. names.

  2. The key properties of instances with aliases must be initialized in the instance specification, or their default values must be non-NULL. (See pywbem issue #1079).

  3. An alias must be defined before it is used. In DSP0004, no such requirement is documented. (See pywbem issue #1079).

  4. The namespace pragma only accepts CIM namespace name and not full CIM namespace path as defined in DSP0004. If the host component is part of the namespace name in a namespace pragma, the compiler generates an exception.

The MOF compiler API provides for invoking the MOF compiler programmatically. It consists of the following parts, which are described in the remaining sections of this chapter:

  • MOFCompiler Class - Describes the MOFCompiler class, which allows invoking the MOF compiler programmatically.

  • Repository connections - Describes the BaseRepositoryConnection class that defines the interface for connecting to a CIM repository. This is an extension point where users can implement a CIM repository for use by the MOF compiler.

  • Exceptions - Describes the exceptions that can be raised by the MOF compiler API.

8.1. MOFCompiler Class

class pywbem.MOFCompiler(handle, search_paths=None, verbose=False, log_func=<function _print_logger>)[source]

A MOF compiler. See MOF compiler for an explanation of MOF compilers in general.

A MOF compiler may be associated with one CIM repository. The repository is used for looking up dependent CIM elements (e.g. the superclass specified in a class whose MOF definition is being compiled), and it is also updated with the result of the compilation. A repository contains CIM namespaces, and the namespaces contain CIM classes, instances and qualifier types.

The association of a MOF compiler with a CIM repository is established when creating an object of this class. The interactions with the CIM repository are defined in the abstract base class BaseRepositoryConnection.

Parameters:
  • handle (BaseRepositoryConnection or WBEMConnection) –

    A handle identifying the CIM repository that will be associated with the MOF compiler.

    If the provided object is a repository connection (i.e. derived from BaseRepositoryConnection, typically that would be a MOFWBEMConnection object), it is directly used by the MOF compiler to interface with the repository.

    If the provided object is a WBEM connection (i.e. WBEMConnection or FakedWBEMConnection), the MOF compiler connects directly to interface defined by handle.

    None means that no CIM repository will be associated. In this case, the MOF compiler can only process standalone MOF that does not depend on existing CIM elements in the repository.

  • search_paths (iterable of string or string) –

    Directory path name(s) where the MOF compiler will search for MOF dependent files if the MOF element they define is not in the target namespace of the CIM repository. The compiler searches the specified directories and their subdirectories.

    MOF dependent files are:

    • The MOF file defining the superclass of a class that is compiled. The MOF file searched for is ‘<classname>.mof’.

    • The MOF file defining the qualifier type of a qualifier that is specified on a MOF element that is compiled. The MOF files searched for are ‘qualifiers.mof’ and ‘qualifiers_optional.mof’.

    • The MOF file of a class specified in a reference property or in the EmbeddedInstance qualifier that is compiled. The MOF file searched for is ‘<classname>.mof’. This is only partly implemented, see issue #1138.

    Note that MOF include files are not searched for; they are specified in the pragma include directive as a file path relative to the including file.

  • verbose (bool) – Indicates whether to issue more detailed compiler messages.

  • log_func (callable) – A logger function that is invoked for each compiler message. The logger function must take one parameter of string type (byte string or unicode string). The default logger function prints to stdout. If None, compiler messages are not logged.

Methods:

compile_embedded_value(mof, ns[, filename])

Compile a string of MOF statements that must represent one or CIMInstance objects and save the resulting CIMInstance(s) in a known variable.

compile_file(filename, ns)

Compile a MOF file into a namespace of the associated CIM repository.

compile_string(mof, ns[, filename])

Compile a string of MOF statements into a namespace of the associated CIM repository.

conn_close()

Close the underlying connection, if it is a WBEMConnection.

find_mof(classname)

Find the MOF file that defines a particular CIM class, in the search path of the MOF compiler.

rollback([verbose])

Rollback any changes to the CIM repository that were performed by compilations using this MOF compiler object, since the object was created.

compile_embedded_value(mof, ns, filename=None)[source]

Compile a string of MOF statements that must represent one or CIMInstance objects and save the resulting CIMInstance(s) in a known variable. Thiis method in conjunction with the compiler does not put the compiled instances into the repository but returns them to the user.

Parameters:
  • mof (string or list of string) – The string or list of strings MOF statements to be compiled.

  • ns (string) – The name of the CIM namespace in the associated CIM repository that is used for lookup of any dependent CIM elements, and that is also the target of the compilation. If None, the default namespace of the connection is used. The namespace specified in this parameter must exist.

  • filename (string) – The path name of the file that the MOF statements were read from. This information is used only in compiler messages.

Raises:

MOFCompileError – Error compiling the MOF.

compile_file(filename, ns)[source]

Compile a MOF file into a namespace of the associated CIM repository.

Parameters:
  • filename (string) – The path name of the MOF file containing the MOF statements to be compiled.

  • ns (string) – The name of the CIM namespace in the associated CIM repository that is the target of the compilation, and is also used for lookup of any dependent CIM elements. If None, the default namespace of the connection is used. A namespace defined in a namespace pragma of the MOF superceeds this namespace from the point in the compilation unit(string/file) where it is declared. The namespace specified in this parameter or the MOF inamespace pragma must exist.

Raises:
compile_string(mof, ns, filename=None)[source]

Compile a string of MOF statements into a namespace of the associated CIM repository.

Parameters:
  • mof (string) – The string of MOF statements to be compiled.

  • ns (string) – The name of the CIM namespace in the associated CIM repository that is the target of the compilation, and is also used for lookup of any dependent CIM elements. If None, the default namespace of the connection is used. A namespace defined in a MOF ‘#pragma namespace’ directive supersedes this namespace from the point in the compilation unit(string/file) where it is declared. The namespace specified in this parameter or in the MOF ‘#pragma namespace’ directive must exist.

  • filename (string) – The path name of the file that the MOF statements were read from. This information is used only in compiler messages.

Raises:

MOFCompileError – Error compiling the MOF.

conn_close()[source]

Close the underlying connection, if it is a WBEMConnection.

find_mof(classname)[source]

Find the MOF file that defines a particular CIM class, in the search path of the MOF compiler.

The MOF file is found based on its file name: It is assumed that the base part of the file name is the CIM class name.

Example: The class “CIM_ComputerSystem” is expected to be in a file “CIM_ComputerSystem.mof”.

Parameters:

classame (string) – The name of the CIM class to look up.

Returns:

Path name of the MOF file defining the CIM class, if it was found. None, if it was not found.

Return type:

string

rollback(verbose=False)[source]

Rollback any changes to the CIM repository that were performed by compilations using this MOF compiler object, since the object was created.

8.2. Repository connections

class pywbem.BaseRepositoryConnection[source]

An abstract base class for implementing CIM repository connections (or an entire CIM repository) for use by the MOF compiler. This class defines the interface that is used by the MOFCompiler class when it interacts with its associated CIM repository.

Class MOFCompiler invokes only the WBEM operations that are defined as methods on this class:

Raises:

Implementation classes should raise only exceptions derived from Error or use assert for methods that are not implemented. Other exceptions are considered programming errors.

Methods:

CreateClass(*args, **kwargs)

Create a CIM class in a namespace of the CIM repository.

CreateInstance(*args, **kwargs)

Create a CIM instance in a namespace of the CIM repository.

DeleteClass(*args, **kwargs)

Delete a CIM class in a namespace of the CIM repository.

DeleteInstance(*args, **kwargs)

Delete a CIM instance in a namespace of the CIM repository.

DeleteQualifier(*args, **kwargs)

Delete a CIM qualifier type in a namespace of the CIM repository.

EnumerateInstanceNames(*args, **kwargs)

Enumerate the instance paths of CIM instances in a namespace of the CIM repository.

EnumerateQualifiers(*args, **kwargs)

Enumerate the CIM qualifier types in a namespace of the CIM repository.

GetClass(*args, **kwargs)

Retrieve a CIM class in a namespace of the CIM repository.

GetQualifier(*args, **kwargs)

Retrieve a CIM qualifier type in a namespace of the CIM repository.

ModifyClass(*args, **kwargs)

Modify a CIM class in a namespace of the CIM repository.

ModifyInstance(*args, **kwargs)

Modify a CIM instance in a namespace of the CIM repository.

SetQualifier(*args, **kwargs)

Create or modify a CIM qualifier type in a namespace of the CIM repository.

Attributes:

default_namespace

The default repository namespace.

abstract CreateClass(*args, **kwargs)[source]

Create a CIM class in a namespace of the CIM repository.

For a description of the parameters, see pywbem.WBEMConnection.CreateClass().

abstract CreateInstance(*args, **kwargs)[source]

Create a CIM instance in a namespace of the CIM repository.

For a description of the parameters, see pywbem.WBEMConnection.CreateInstance().

abstract DeleteClass(*args, **kwargs)[source]

Delete a CIM class in a namespace of the CIM repository.

For a description of the parameters, see pywbem.WBEMConnection.DeleteClass().

abstract DeleteInstance(*args, **kwargs)[source]

Delete a CIM instance in a namespace of the CIM repository.

For a description of the parameters, see pywbem.WBEMConnection.DeleteInstance().

abstract DeleteQualifier(*args, **kwargs)[source]

Delete a CIM qualifier type in a namespace of the CIM repository.

For a description of the parameters, see pywbem.WBEMConnection.DeleteQualifier().

abstract EnumerateInstanceNames(*args, **kwargs)[source]

Enumerate the instance paths of CIM instances in a namespace of the CIM repository.

For a description of the parameters, see pywbem.WBEMConnection.EnumerateInstanceNames().

abstract EnumerateQualifiers(*args, **kwargs)[source]

Enumerate the CIM qualifier types in a namespace of the CIM repository.

For a description of the parameters, see pywbem.WBEMConnection.EnumerateQualifiers().

abstract GetClass(*args, **kwargs)[source]

Retrieve a CIM class in a namespace of the CIM repository.

For a description of the parameters, see pywbem.WBEMConnection.GetClass().

abstract GetQualifier(*args, **kwargs)[source]

Retrieve a CIM qualifier type in a namespace of the CIM repository.

For a description of the parameters, see pywbem.WBEMConnection.GetQualifier().

abstract ModifyClass(*args, **kwargs)[source]

Modify a CIM class in a namespace of the CIM repository.

For a description of the parameters, see pywbem.WBEMConnection.ModifyClass().

abstract ModifyInstance(*args, **kwargs)[source]

Modify a CIM instance in a namespace of the CIM repository.

For a description of the parameters, see pywbem.WBEMConnection.ModifyInstance().

abstract SetQualifier(*args, **kwargs)[source]

Create or modify a CIM qualifier type in a namespace of the CIM repository.

For a description of the parameters, see pywbem.WBEMConnection.SetQualifier().

property default_namespace

The default repository namespace.

This property is settable.

Type:

string

class pywbem.MOFWBEMConnection(conn=None)[source]

A CIM repository connection to an in-memory repository on top of an optional underlying WBEM connection.

If a WBEM connection is provided with the conn parameter, that connection is the target for any operations that acquire CIM objects and the in-memory store acts as a cache for CIM qualifiers declarations, CIM Classes, and CIM Instances created and as a rollback log in support of rolling back the operations. This is the mode in which the MOF compiler uses this class.

If the underlying WBEM connection is not provided, the in-memory repository acts as a CIM repository that is targeted by the operations. This mode is used for testing only.

MOFWBEMConnection only implements the BaseRepositoryConnection methods required to implement the mof compiler rollback functionality.

This class implements the BaseRepositoryConnection interface.

This implementation sets the path component of instances created including keybindings using property values in the instance. It does NOT confirm that all key properties are included in the path.

Raises:

The methods of this class may raise any exceptions described for class WBEMConnection.

Parameters:

conn (BaseRepositoryConnection) –

The underlying repository connection.

None means that there is no underlying repository and all operations performed through this object will fail.

Methods:

CreateClass(*args, **kwargs)

Create a CIM class in the local repository of this class.

CreateInstance(*args, **kwargs)

Create a CIM instance in the local repository of this class.

DeleteClass(*args, **kwargs)

This method is only invoked by rollback() (on the underlying repository), and never by the MOF compiler, and is therefore not implemented.

DeleteInstance(*args, **kwargs)

This method is only invoked by rollback() (on the underlying repository), and never by the MOF compiler, and is therefore not implemented.

DeleteQualifier(*args, **kwargs)

This method is only invoked by rollback() (on the underlying repository), and never by the MOF compiler, and is therefore not implemented.

EnumerateInstanceNames(*args, **kwargs)

This method is used by the MOF compiler only when it creates a namespace in the course of handling CIM_ERR_NAMESPACE_NOT_FOUND.

EnumerateQualifiers(*args, **kwargs)

Enumerate the qualifier types in the local repository of this class.

GetClass(*args, **kwargs)

Retrieve a CIM class from the local repository of this class.

GetQualifier(*args, **kwargs)

Retrieve a qualifier type from the local repository of this class.

ModifyClass(*args, **kwargs)

This method is used by the MOF compiler only in the course of handling CIM_ERR_ALREADY_EXISTS after trying to create a class.

ModifyInstance(*args, **kwargs)

This method is used by the MOF compiler only in the course of handling CIM_ERR_ALREADY_EXISTS after trying to create an instance.

SetQualifier(*args, **kwargs)

Create or modify a qualifier type in the local repository of this class.

getns()

string: Return the default repository namespace to be used.

rollback([verbose])

Remove classes and instances from the underlying repository, that have been created in the local repository of this class.

setns(value)

Set the default repository namespace to be used.

Attributes:

default_namespace

The default repository namespace to be used.

CreateClass(*args, **kwargs)[source]

Create a CIM class in the local repository of this class.

For a description of the parameters, see pywbem.WBEMConnection.CreateClass().

CreateInstance(*args, **kwargs)[source]

Create a CIM instance in the local repository of this class. This implementation does not test for duplicate instances but appends each new instance to the repository.

For a description of the parameters, see pywbem.WBEMConnection.CreateInstance().

DeleteClass(*args, **kwargs)[source]

This method is only invoked by rollback() (on the underlying repository), and never by the MOF compiler, and is therefore not implemented.

DeleteInstance(*args, **kwargs)[source]

This method is only invoked by rollback() (on the underlying repository), and never by the MOF compiler, and is therefore not implemented.

DeleteQualifier(*args, **kwargs)[source]

This method is only invoked by rollback() (on the underlying repository), and never by the MOF compiler, and is therefore not implemented.

EnumerateInstanceNames(*args, **kwargs)[source]

This method is used by the MOF compiler only when it creates a namespace in the course of handling CIM_ERR_NAMESPACE_NOT_FOUND. Because the operations of this class silently create every namespace that is needed and never return that error, this method is never called, and is therefore not implemented.

EnumerateQualifiers(*args, **kwargs)[source]

Enumerate the qualifier types in the local repository of this class.

For a description of the parameters, see pywbem.WBEMConnection.EnumerateQualifiers().

GetClass(*args, **kwargs)[source]

Retrieve a CIM class from the local repository of this class.

For a description of the parameters, see pywbem.WBEMConnection.GetClass().

GetQualifier(*args, **kwargs)[source]

Retrieve a qualifier type from the local repository of this class.

For a description of the parameters, see pywbem.WBEMConnection.GetQualifier().

ModifyClass(*args, **kwargs)[source]

This method is used by the MOF compiler only in the course of handling CIM_ERR_ALREADY_EXISTS after trying to create a class. Because CreateClass() overwrites existing classes, this method is never called, and is therefore not implemented.

ModifyInstance(*args, **kwargs)[source]

This method is used by the MOF compiler only in the course of handling CIM_ERR_ALREADY_EXISTS after trying to create an instance. Because CreateInstance() overwrites existing instances, this method is never called, and is therefore not implemented. NOTE: This error means that the mof compiler logic to attempt modifyinstance if createinstance fails does not attempt the modifyinstance.

SetQualifier(*args, **kwargs)[source]

Create or modify a qualifier type in the local repository of this class.

For a description of the parameters, see pywbem.WBEMConnection.SetQualifier().

property default_namespace

The default repository namespace to be used.

The default repository namespace is the default namespace of the underlying repository connection if there is such an underlying connection, or the default namespace of this object.

Initially, the default namespace of this object is ‘root/cimv2’.

This property is settable. Setting it will cause the default namespace of the underlying repository connection to be updated if there is such an underlying connection, or the default namespace of this object.

Type:

string

getns()

string: Return the default repository namespace to be used.

This method exists for compatibility. Use the default_namespace property instead.

rollback(verbose=False)[source]

Remove classes and instances from the underlying repository, that have been created in the local repository of this class.

Limitations:

1. At this point, only classes and instances will be removed, but not qualifiers.

2. This may not work with instances created by other means, ex. other mof_compilers because of amgiguity in the definition of instance names for associations (ex. The namespace component in reference properties)

3. This only removes the classes specifically defined in the compiled mof and not any classes installed as prerquisits as part of the compile (ex. superclasses, classes defined by references)

setns(value)

Set the default repository namespace to be used.

This method exists for compatibility. Use the default_namespace property instead.

8.3. Exceptions

The MOF compiler API raises exceptions that are derived from the common base class MOFCompileError.

class pywbem.MOFCompileError(msg, parser_token=None)[source]

Base class for exceptions indicating issues with compiling MOF.

Derived from Error.

Parameters:
  • msg (string) – Message text describing the error.

  • parser_token (lex.LexToken or yacc.YaccProduction) –

    PLY lex or yacc parser token (that is, the p argument of a yacc parser function or the t argument of a lex parser function). This token is used to obtain the MOF source text and location information.

    None will result in no MOF source text and location information to be obtained.

Attributes:

__cause__

exception cause

__context__

exception context

column

Position within the line in the MOF file or MOF string where the error occurred (1-based).

conn_id

Connection ID of the connection in whose context the error happened.

conn_str

String that identifies the connection in exception messages.

context

MOF context, consisting of a first line that is the MOF line in error, and a second line that uses the '^' character to indicate the position of the token in error in the MOF line.

file

File name of the MOF file where the error occurred.

lineno

Line number in the MOF file or MOF string where the error occurred (1-based).

msg

Message text describing the error.

Methods:

__delattr__(name, /)

Implement delattr(self, name).

__getattribute__(name, /)

Return getattr(self, name).

__new__(**kwargs)

__reduce__

Helper for pickle.

__repr__()

Return repr(self).

__setattr__(name, value, /)

Implement setattr(self, name, value).

__str__()

Return str(self).

add_note

Exception.add_note(note) -- add a note to the exception

get_err_msg()

Return a multi-line error message for being printed, in the following format.

with_traceback

Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.

__str__()[source]

Return str(self).

property column

Position within the line in the MOF file or MOF string where the error occurred (1-based).

Type:

integer

property context

MOF context, consisting of a first line that is the MOF line in error, and a second line that uses the ‘^’ character to indicate the position of the token in error in the MOF line.

Type:

string

property file

File name of the MOF file where the error occurred.

None if the error occurred in a MOF string that was compiled.

Type:

string

get_err_msg()[source]

Return a multi-line error message for being printed, in the following format. The text in angle brackets refers to the same-named properties of the exception instance:

<error kind>:<file>:<lineno>:<colno>: <msg>
<context - MOF line>
<context - position indicator line>
Returns:

Multi-line error message.

Return type:

string

property lineno

Line number in the MOF file or MOF string where the error occurred (1-based).

Type:

integer

property msg

Message text describing the error.

Type:

string

class pywbem.MOFParseError(msg, parser_token=None)[source]

Exception indicating that MOF cannot be parsed correctly, e.g. for syntax errors.

Derived from MOFCompileError.

Parameters:
  • msg (string) – Message text describing the error.

  • parser_token (lex.LexToken or yacc.YaccProduction) –

    PLY lex or yacc parser token (that is, the p argument of a yacc parser function or the t argument of a lex parser function). This token is used to obtain the MOF source text and location information.

    None will result in no MOF source text and location information to be obtained.

Attributes:

__cause__

exception cause

__context__

exception context

column

Position within the line in the MOF file or MOF string where the error occurred (1-based).

conn_id

Connection ID of the connection in whose context the error happened.

conn_str

String that identifies the connection in exception messages.

context

MOF context, consisting of a first line that is the MOF line in error, and a second line that uses the '^' character to indicate the position of the token in error in the MOF line.

file

File name of the MOF file where the error occurred.

lineno

Line number in the MOF file or MOF string where the error occurred (1-based).

msg

Message text describing the error.

Methods:

__delattr__(name, /)

Implement delattr(self, name).

__getattribute__(name, /)

Return getattr(self, name).

__new__(**kwargs)

__reduce__

Helper for pickle.

__repr__()

Return repr(self).

__setattr__(name, value, /)

Implement setattr(self, name, value).

__str__()

Return str(self).

add_note

Exception.add_note(note) -- add a note to the exception

get_err_msg()

Return a multi-line error message for being printed, in the following format.

with_traceback

Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.

class pywbem.MOFDependencyError(msg, parser_token=None)[source]

Exception indicating that MOF cannot be compiled because of a missing dependency. For example, the MOF to be compiled specifies a class but the superclass of the class cannot be found.

Derived from MOFCompileError.

Parameters:
  • msg (string) – Message text describing the error.

  • parser_token (lex.LexToken or yacc.YaccProduction) –

    PLY lex or yacc parser token (that is, the p argument of a yacc parser function or the t argument of a lex parser function). This token is used to obtain the MOF source text and location information.

    None will result in no MOF source text and location information to be obtained.

Attributes:

__cause__

exception cause

__context__

exception context

column

Position within the line in the MOF file or MOF string where the error occurred (1-based).

conn_id

Connection ID of the connection in whose context the error happened.

conn_str

String that identifies the connection in exception messages.

context

MOF context, consisting of a first line that is the MOF line in error, and a second line that uses the '^' character to indicate the position of the token in error in the MOF line.

file

File name of the MOF file where the error occurred.

lineno

Line number in the MOF file or MOF string where the error occurred (1-based).

msg

Message text describing the error.

Methods:

__delattr__(name, /)

Implement delattr(self, name).

__getattribute__(name, /)

Return getattr(self, name).

__new__(**kwargs)

__reduce__

Helper for pickle.

__repr__()

Return repr(self).

__setattr__(name, value, /)

Implement setattr(self, name, value).

__str__()

Return str(self).

add_note

Exception.add_note(note) -- add a note to the exception

get_err_msg()

Return a multi-line error message for being printed, in the following format.

with_traceback

Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.

class pywbem.MOFRepositoryError(msg, parser_token=None, cim_error=None)[source]

Exception indicating that MOF cannot be compiled because of a CIM error returned by the target CIM repository. The CIM error is attached to this exception and is part of the exception message.

Derived from MOFCompileError.

Parameters:
  • msg (string) – Message text describing the error.

  • parser_token (lex.LexToken or yacc.YaccProduction) –

    PLY lex or yacc parser token (that is, the p argument of a yacc parser function or the t argument of a lex parser function). This token is used to obtain the MOF source text and location information.

    None will result in no MOF source text and location information to be obtained.

  • cim_error (CIMError) – CIM error returned by the CIM repository.

Attributes:

__cause__

exception cause

__context__

exception context

cim_error

CIM error returned by the CIM repository.

column

Position within the line in the MOF file or MOF string where the error occurred (1-based).

conn_id

Connection ID of the connection in whose context the error happened.

conn_str

String that identifies the connection in exception messages.

context

MOF context, consisting of a first line that is the MOF line in error, and a second line that uses the '^' character to indicate the position of the token in error in the MOF line.

file

File name of the MOF file where the error occurred.

lineno

Line number in the MOF file or MOF string where the error occurred (1-based).

msg

Message text describing the error.

Methods:

__delattr__(name, /)

Implement delattr(self, name).

__getattribute__(name, /)

Return getattr(self, name).

__new__(**kwargs)

__reduce__

Helper for pickle.

__repr__()

Return repr(self).

__setattr__(name, value, /)

Implement setattr(self, name, value).

__str__()

Return str(self).

add_note

Exception.add_note(note) -- add a note to the exception

get_err_msg()

Return a multi-line error message for being printed, in the following format.

with_traceback

Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.

property cim_error

CIM error returned by the CIM repository.

Type:

CIMError

get_err_msg()[source]

Return a multi-line error message for being printed, in the following format. The text in angle brackets refers to the same-named properties of the exception instance:

<error kind>:<file>:<lineno>:<colno>: <msg>
<context - MOF line>
<context - position indicator line>
<CIM error>
Returns:

Multi-line error message.

Return type:

string