Pywbemtools - A set of tools using pywbem¶
This package contains tools that provide a command line interface to interact with WBEM servers
The pywbemtools github page is: https://github.com/pywbem/pywbemtools.
Introduction¶
Pywbemtools features¶
Pywbemtools is a collection of command line tools that communicate with WBEM servers. The tools are written in pure Python and support Python 2 and Python 3.
At this point, pywbemtools includes a single command line tool named
pywbemcli
that uses the pywbem package on Pypi to issue operations to a
WBEM server using the CIM/WBEM standards defined by the DMTF to perform
system management tasks.
CIM/WBEM standards are used for a wide variety of systems management tasks in the industry including DMTF management standards and the SNIA Storage Management Initiative Specification (SMI-S).
The pywbemtools package includes the following tools:
Pywbemcli command - provides access to WBEM servers from the command line
Supported environments¶
The pywbemtools package is supported in these environments:
Operating systems: Linux, Windows (native and Unix-like environments (ex. Cygwin), OS-X
Python versions: 2.7, 3.4, and greater
WBEM servers: Any WBEM server that conforms to the DMTF specifications listed in Standards conformance. WBEM servers supporting older versions of these standards are also supported, but may have limitations. See the pywbem WBEM servers documentation for more details.
Installation¶
This section describes the complete installation of pywbemtools with all steps including prerequisite operating system packages.
The easiest way to install the pywbemtools package is using pip. Pip ensures that any dependent Python packages also get installed.
Pip will install the packages into your currently active Python environment (your system Python or your predefined virtual Python environment).
It is beneficial to set up a virtual Python environment for your project,
because that leaves your system Python installation unchanged, it does not
require sudo
rights, and gives you better control about the installed
packages and their versions.
If you want to contribute to the pywbem project, you need to set up a development and test environment for pywbem. That has a larger set of OS-level prerequisites and its setup is described in the Pywbemtools development chapter.
Installation prerequisites¶
The Python environment into which you want to install must have the following Python packages installed:
setuptools - http://pypi.python.org/pypi/setuptools
wheel
pip - generally installed with Python 3.x but may be a separate install with Python 2.7 and with Cygwin Python releases.
Pywbemtools installs the pywbem package.
When using pywbem versions before 1.0.0 on Python 2, pywbem requires a number of OS-level packages, and your system must have the following commands installed:
On native Windows:
choco
- Chocolatey package manager. The pywbemtools package installation uses Chocolatey to install OS-level software. See https://chocolatey.org/ for the installation instructions for Chocolatey.wget
- Download tool. Can be installed with:choco install wget
.
On Linux, OS-X, UNIX-like environments on Windows (e.g. Cygwin):
wget
- Download tool. Can be installed using the OS-level package manager for the platform.
Installation with pip¶
When using pywbem versions before 1.0.0 on Python 2, install the OS-level packages needed by the pywbem package as follows:
On native Windows:
> wget -q https://raw.githubusercontent.com/pywbem/pywbem/master/pywbem_os_setup.bat > pywbem_os_setup.bat
On Linux, OS-X, UNIX-like environments on Windows (e.g. Cygwin):
$ wget -q https://raw.githubusercontent.com/pywbem/pywbem/master/pywbem_os_setup.sh $ chmod 755 pywbem_os_setup.sh $ ./pywbem_os_setup.sh
The
pywbem_os_setup.sh
script uses sudo internally, so your userid needs to have sudo permission.
If you want to install the needed OS-level packages manually, see pywbem prerequisite OS packages.
The following command downloads and installs the latest released version of the pywbemtools package from PyPI into the currently active Python environment:
$ pip install pywbemtools
As an alternative, if you want to install the latest development level of the
pywbemtools package for some reason, install directly from the master
branch of the Git repository of the package:
$ pip install git+https://github.com/pywbem/pywbemtools.git@master#egg=pywbemtools
Verification of the installation¶
You can verify that the pywbemtools package and its dependent packages are
installed correctly by invoking pywbemcli. Invoking with the --version
option displays the installed version of both pywbem and pywbemtools as
shown in the following example:
$ pywbemcli --version
pywbemcli, version 0.5.0
pywbem, version 0.14.4
Standards conformance¶
Pywbemtools attempts to comply to the maximum possible with the relevant standards.
Pywbemtools uses pywbem for communication with the WBEM server. Therefore pywbemtools conformance to the relevant standards is defined in the pywbem standards conformance documentation.
Therefore, the level of conformance and limitations for pywbemtools is the same as pywbem except for any specific notations in this document.
Deprecation policy¶
Pywbemtools attempts to be as backwards compatible as possible.
Occasionally functionality needs to be retired, because it is flawed and a better but incompatible replacement has emerged.
In pywbemtools, such changes are done by deprecating existing functionality, without removing it. The deprecated functionality is still supported throughout new minor releases. Eventually, a new major release will break compatibility and will remove the deprecated functionality.
In order to prepare users of pywbemtools for that, deprecation of functionality
is stated in the CLI documentation, and is made visible at runtime by issuing
Python warnings of type DeprecationWarning
(see the Python
warnings
module).
Since Python 2.7, DeprecationWarning
messages are suppressed by default.
They can be shown for example by invoking pywbemcli with the environment
variable: PYTHONWARNINGS=default
, or by using the
ref:–warn general option.
It is recommended that users of the pywbemtools package run their test code with
DeprecationWarning
messages being shown, so they become aware of any use of
deprecated functionality.
Here is a summary of the deprecation and compatibility policy used by pywbemtools, by release type:
New update release (M.N.U -> M.N.U+1): No new deprecations; fully backwards compatible.
New minor release (M.N.U -> M.N+1.0): New deprecations may be added; as backwards compatible as possible.
New major release (M.N.U -> M+1.0.0): Deprecated functionality may get removed; backwards compatibility may be broken.
Compatibility is always seen from the perspective of the user of pywbemtools, so a backwards compatible new pywbemtools release means that the user can safely upgrade to that new release without encountering compatibility issues.
Versioning¶
This documentation applies to version 0.9.1 of the pywbemtools package. You can also see that version in the top left corner of this page.
The pywbemtools package uses the rules of Semantic Versioning 2.0.0 for its version.
This documentation may have been built from a development level of the package. You can recognize a development version of this package by the presence of a “.devD” suffix in the version string. Development versions are pre-versions of the next assumed version that is not yet released. For example, version 0.5.1.dev2 is development pre-version #2 of the next version to be released after 0.5.0. Version 1.5.1 is an assumed next version, because the actually released next version might be 0.7.0 or even 1.0.0.
Compatibility¶
In this package, compatibility is always seen from the perspective of the user of the package. Thus, a backwards compatible new version of this package means that the user can safely upgrade to that new version without encountering compatibility issues.
This package uses the rules of Semantic Versioning 2.0.0 for compatibility between package versions, and for deprecations.
The public command line interface of this package that is subject to the semantic versioning rules (and specifically to its compatibility rules) is the CLI syntax described in this documentation.
The output formats are currently not the subject of compatibility assurances.
Violations of these compatibility rules are described in section Change log.
Reporting issues¶
If you encounter any problem with this package, or if you have questions of any kind related to this package (even when they are not about a problem), please open an issue in the pywbemtools issue tracker.
License¶
This package is licensed under the Apache 2.0 License.
Pywbemcli command¶
Pywbemcli provides access to WBEM servers from the command line. It provides functionality to:
Explore the CIM data of WBEM servers. It can manage/inspect the CIM model components including CIM classes, CIM instances, and CIM qualifiers and execute CIM methods and queries on the WBEM server.
Execute specific CIM-XML operations on the WBEM server as defined in DMTF standard DSP0200 (CIM Operations over HTTP).
Inspect and manage WBEM server functionality including:
Advertised WBEM management profiles
WBEM server brand and version information
Capture detailed information on CIM-XML interactions with the WBEM server including time statistics and details of data flow.
Maintain a file with persisted WBEM connection definitions so that pywbemcli can access multiple WBEM servers by name.
Provide both a command line mode and an interactive mode where multiple pywbemcli commands can be executed within the context of a WBEM server.
Use an integrated mock WBEM server to try out commands. The mock server can be loaded with CIM objects defined in MOF files or via Python scripts.
Pywbemcli command line interface¶
This section describes the command line interface of the pywbemcli command within the pywbemtools package.
Pywbemcli provides a command line interface(CLI) interaction with WBEM servers.
The command line can contain the following components:
GENERAL-OPTIONS - General options; they apply to all commands. See Using the pywbemcli command line general options for information on the pywbemcli general options.
- COMMAND - A name of a command which may consist of:
<group name> <command name> for commands that are defined within groups (ex.
class find
).<group name> (ex.
class
) to show group help including list of command within the group.<command name> for those commands that are not part of a group. For example
repl
andhelp
that are not in any command group.
ARGS - Arguments for a command.
COMMAND-OPTIONS - Options that apply only to a particular COMMAND.
Options are prefixed with the characters -
for the short form or --
for
the long form (ex. -n
or --namespace
). The other components do not
begin with -
.
Command groups are named after the objects the commands operate on
(ex. class
, instance
, qualifier
, server
). Executing
$ pywbemcli --help
...
Commands:
class Command group for CIM classes.
...
returns the list of command groups under the title COMMANDS.
Commands are named after actions on these objects
(ex. get
, create
, delete
). The list of commands for each group
is listed with the command pywbemcli <group name> –help.
For example, the command:
$ pywbemcli --output-format mof class get CIM_ManagedElement --namespace interop
gets class CIM_ManagedElement
in namespace interop
and displays it in
the MOF output format. The option --output-format
is a general option
and --namespace
is a command option.
Pywbemcli supports several modes of tab-completion, auto-completion suggestions depending on whether it is in command or interactive mode. This is detailed in the following sections.
Modes of operation¶
Pywbemcli supports two modes of operation:
Command mode: Executing standalone non-interactive commands.
Interactive mode: Invoking an interactive pywbemcli shell for typing pywbemcli commands.
Command mode¶
In command mode, the pywbemcli command performs its task and terminates like any other standalone non-interactive command.
This mode is used when the pywbemcli command is invoked with a command or command group name and arguments/options:
$ pywbemcli [GENERAL-OPTIONS] COMMAND [COMMAND-OPTIONS] [ARGS]
The following example enumerates classes in the root/cimv2
namespace of the
WBEM server on localhost
:
$ pywbemcli --server http://localhost --default-namespace root/cimv2 --user username class enumerate
Enter password: <password>
. . .
<Returns MOF for the enumerated classes>
In command mode, tab completion is also supported for some command shells, but must be enabled specifically for each shell.
For example, with a bash shell, enter the following to enable tab completion of pywbemcli:
$ eval "$(_PYWBEMCLI_COMPLETE=source pywbemcli)"
Bash tab completion for pywbemcli
is used like any other bash tab
completion:
$ pywbemcli --<TAB><TAB>
... <shows the general options to select from>
$ pywbemcli <TAB><TAB>
... <shows the command groups to select from>
$ pywbemcli class <TAB><TAB>
... <shows the class commands to select from>
Pywbemcli uses the Python click package for its command line handling. See Bash Complete in the Click documentation for additional features of the Bash tab completion of pywbemcli.
Interactive mode¶
In interactive mode (also known as REPL mode), pywbem provides an interactive shell environment that allows typing pywbemcli commands, internal commands (for operating the pywbemcli shell), and external commands (that are executed in the standard shell of the user).
This pywbemcli shell is started when the pywbemcli
command is invoked
without specifying any command group or command:
$ pywbemcli [GENERAL-OPTIONS]
pywbemcli> _
Alternatively, the pywbemcli shell can also be started by specifying the repl
command:
$ pywbemcli [GENERAL-OPTIONS] repl
pywbemcli> _
The pywbemcli shell uses the prompt pywbemcli>
. The cursor is shown in
the examples above as an underscore (_
).
The commands and options that can be typed in the pywbemcli shell are the rest
of the command line that would follow the pywbemcli
command in
command mode, as well as internal commands (for operating the pywbemcli
shell), and external commands (that are executed in the standard shell of the
user):
pywbemcli> [GENERAL-OPTIONS] COMMAND [ARGS] [COMMAND-OPTIONS]
where: COMMAND can be either a group name and
a command (ex. class find or repl)
pywbemcli> :INTERNAL-COMMAND
pywbemcli> !EXTERNAL-COMMAND
The following example starts a pywbemcli shell in interactive mode, executes several commands, and exits the shell:
$ pywbemcli -s http://localhost -d root/cimv2 -u username
pywbemcli> class enumerate --no
. . . <Enumeration of class names in the default namespace>
pywbemcli> class get CIM_System
. . . <Class CIM_System in the default namespace in MOF format>
pywbemcli> :q
The pywbemcli shell command class get CIM_System
in the example
above has the same effect as the standalone command:
$ pywbemcli -s http://localhost -d root/cimv2 -u username class get CIM_System
. . . <Class CIM_System in the default namespace in MOF format>
The internal commands :?
, :h
, or :help
display general help
information for external and internal commands:
> :help
REPL help:
External Commands:
prefix external commands with "!"
Internal Commands:
prefix internal commands with ":"
:?, :h, :help displays general help information
:exit, :q, :quit exits the REPL
In addition to using one of the internal exit commands shown in the help text above, you can also exit the pywbemcli shell by typing Ctrl-D (on Linux, OS-X and UNIX-like environments on Windows), or Ctrl-C (on native Windows).
Typing --help
or -h
in the pywbemcli shell displays general help
information for the pywbemcli commands which includes general options and a
list of the supported command groups and commands without command group.
$ pywbemcli
pywbemcli> --help
Usage: pywbemcli [GENERAL-OPTIONS] COMMAND [ARGS] [COMMAND-OPTIONS]
. . .
General Options:
-n, --name NAME Use the WBEM server ...
. . .
Commands:
class Command group for CIM classes.
connection Command group for WBEM connection definitions.
. . .
The usage line in this help text shows the usage in command mode. In
interactive mode, the pywbemcli
word is omitted.
Typing COMMAND --help
, or COMMAND -h
in the pywbemcli shell
displays help information for the specified pywbemcli command group, for
example:
pywbemcli> class --help
Usage: pywbemcli [GENERAL-OPTIONS] class COMMAND [ARGS] [COMMAND-OPTIONS]
. . .
Command Options:
-h, --help Show this message and exit.
Commands:
associators List the classes associated with a class.
. . .
The pywbemcli shell in the interactive mode supports popup help text while for
commands, arguments, and options typing, where the valid choices are shown
based upon what was typed so far, and where an item from the popup list can be
picked with <TAB> or with the cursor keys. It can be used to select from the
list of general options. In the following examples, an underscore _
is
shown as the cursor:
pywbemcli> --_
--name Use the WBEM server defined by the WBEM connection ...
--mock-server Use a mock WBEM server that is automatically ...
--server Use the WBEM server at the specified URL with ...
. . .
pywbemcli> cl_
class
The pywbemcli shell supports history across multiple invocations of the shell using <UP_ARROW>, <DOWN-ARROW> to step through the history line by line.
A incremental search of the history can be initiated by entering <CTRL-r> followed by one or more characters that define the search. The search displays the last command containing the search string. This search string can be modified in place to change the search, returning the last command in the command history that contains the the string. <UP_ARROW>, <DOWN-ARROW> will find other commands in the history containing the same string.
pywbemcli> <CTRL-r>
(reverse-i-search)`':
ENTER Characters CIM
(reverse-i-search)`CIM': class get CIM_ManagedElement
<UP-ARROW> and <DOWN-ARROW> find
other commands containing of "CIM"
<DOWN_ARROW>
(i-search)`get': instance get CIM_ComputerSystem.?
Hit <ENTER> selects current found command
pywbemcli> instance get CIM_ComputerSystem.?
The pywbemcli history is stored in the user home directory, ~/.pywbemcli_history
.
The pywbemcli interactive mode also supports automated parameter suggestions based on the pywbemcli history file which works with the auto completion described above. The input is compared to the history and when there is another entry starting with the given text, the completion will be shown as gray text behind the current input. Pressing the right arrow → or c-e will insert this suggestion.
General options can be entered in the interactive mode but they generally only
apply to the current command defined on the same command input as the general
option. Thus, to modify the output format for a particular command, enter the
–output-format general option before the command. The following command
sets the output format to table
before executing the command and then
restores it to the original value.:
pywbemcli> --output-format table instance enumerate CIM_Foo
A particular difference between general options in the interactive mode and the command line mode is the ability to set general options back to their default value in the interactive mode. In the command mode this is not required. However, in the interactive mode, it could be useful to reset a general option to its default value for a command. Thus, if the log was set on startup (–log all), it could be disabled for a command or the user name (–user) could be set back to None. However, normally the default value is only set by not including that general option with the command line input
To reset selected string type general options in the interactive, the string
value of ""
(an empty string) is provided as the value which causes pywbemcli
to set the default value of that general option.
The following code defines a server with –user and password in interactive mode. Then it attempts to modify the user and password to their default values of None and execute the class enumerate again. This command would be executed without using the user and password because they have been reset for that command.
pywbemcli -s https:blah --user fred --pasword blah
pywbemcli> class enumerate
pywbemcli> --user "" --pasword "" class enumerate
Error handling¶
Pywbemcli terminates with one of the following program exit codes:
0 - Success: The pywbemcli command has succeeded.
1 - Error: In such cases, pywbemcli aborts the requested operation and displays one or more human readable error messages on standard error.
If this happens for a command entered in interactive mode, the pywbemcli shell is not terminated; only the command that failed is terminated.
Examples for errors reported that way:
Local system issues, e.g. pywbemcli history file or term:connections file cannot be written to.
WBEM server access issues, e.g. pywbemcli cannot connect to or authenticate with the WBEM server. This includes CIM errors about failed authentication returned by the server.
WBEM server operation issues, e.g. pywbemcli attempts to retrieve an instance that does not exist, or the WBEM server encountered an internal error. This will mostly be caused by CIM errors returned by the server, but can also be caused by the pywbemcli code itself.
Programming errors in mock Python scripts (see: Mock support overview); the error message includes a Python traceback of the error.
1 - Python traceback: In such cases, pywbemcli terminates during its processing, and displays the Python stack traceback on standard error.
If this happens for a command entered in interactive mode, the pywbemcli shell also terminates with a program exit code of 1.
These Python tracebacks should never happen and are always considered a reason to open a bug in the pywbemtools issue tracker.
Note that an error message with a traceback from a mock Python script does not fall into this category and is an issue in that Python script and not in pywbemcli.
2 - User error: In such cases, pywbemcli terminates without even attempting to perform the requested operation, and displays one or more human readable error messages on standard error.
If this happens for a command entered in interactive mode, the pywbemcli shell is not terminated; only the command that failed is terminated.
Examples for user errors are a missing required command argument, the use of an invalid option, or an invalid option argument.
2 - Help: When help is requested (
--help
/-h
option orhelp command
), pywbemcli displays the requested help text on standard output and terminates.If this happens for a command entered in interactive mode, the pywbemcli shell is not terminated; only the command that displayed the help is terminated.
Using the pywbemcli command line general options¶
Overview of the general options¶
General options define:
The connection to the WBEM server against which the pywbemcli commands are to be executed (i.e url, default CIM namespace, security parameters, etc.) or the alternative mock of a WBEM server. See Defining the WBEM server for details.
Operation behavior of pywbemcli for requests; i.e. using the pull operations vs the traditional operations, or the client side timeout. See Controlling operation behavior and monitoring operations for details.
Execution options to monitor the requests and responses (statistics keeping, and logging of operations) and to display the results. See Controlling operation behavior and monitoring operations and Controlling output formats for details.
General options to show the pywbemcli version, and display help for any of the command groups or commands.
General options must be entered on the command line before the command group or command.
For example the following enumerates qualifier declarations and outputs the
result in the simple
table format:
pywbemcli --output-format simple --server http://localhost qualifier enumerate
Qualifier Declarations
Name Type Value Array Scopes Flavors
----------- ------- ------- ------- ----------- ---------------
Description string False ANY EnableOverride
ToSubclass
Translatable
Key boolean False False PROPERTY DisableOverride
REFERENCE ToSubclass
In interactive mode, general options from the command line are defined once and retain their value throughout the execution of the interactive mode.
General options defined in the command line may be overwritten by specifying them on interactive mode commands. The resulting new value is used only for that one command, and is not retained between interactive mode command executions.
In the following example, the --output-format general option is used on an interactive mode command to overwrite the default output format, and the --server general option is used to overwrite the server that was specified in the command line invocation:
$ pywbemcli --server http://myserver
pywbemcli> --output-format table --server http://localhost qualifier enumerate
Qualifier Declarations
+-------------+---------+---------+---------+-----------+-----------------+
| Name | Type | Value | Array | Scopes | Flavors |
+=============+=========+=========+=========+===========+=================+
| Description | string | | False | ANY | EnableOverride |
| | | | | | ToSubclass |
| | | | | | Translatable |
+-------------+---------+---------+---------+-----------+-----------------+
| Key | boolean | False | False | PROPERTY | DisableOverride |
| | | | | REFERENCE | ToSubclass |
+-------------+---------+---------+---------+-----------+-----------------+
Defining the WBEM server¶
The target WBEM server can be defined on the command line in several ways with the following arguments :
Define connection information for a WBEM server by using the --server general option that specifies the URL of the server.
The following general options can be used for specifying additional information for the connection:
The --default-namespace general option defines the default namespace to be used if a command does not specify a namespace.
The --user general option defines the user name for authenticating with the WBEM server.
The --password general option defines the password for authenticating with the WBEM server.
The --verify general option defines whether the client verifies certificates received from the WBEM server.
The --certfile general option defines the client certificate file.
The --keyfile general option defines the client key file.
The --ca-certs general option defines a collection of certificates against which certificates received from the WBEM server are verified.
The --timeout general option defines the client side timeout for operations.
Define a mock WBEM server by using the --mock-server general option.
The mock WBEM server is part of pywbemcli and allows testing or demonstrating pywbemcli without having access to a real WBEM server. For details, see Mock WBEM server support.
Refer to a persisted connection definition for either a WBEM server or mock WBEM server by using the --name general option that specifies the name of the connection definition.
Persisted connection definitions are stored in a connections file and are managed with the connection command group.
Controlling operation behavior and monitoring operations¶
Several general options control the behavior and monitoring of the operations executed against the WBEM server.
The DMTF specifications allow alternative forms of some operations, pywbemcli implements this flexibility and controls the choice of either the pull operations or the traditional operations through the --use-pull general option. With this option the user can choose to use either type of operation if that operation is available on the WBEM server. See Pywbemcli and the DMTF pull operations for more information on pull operations.
Since the pull operations include the ability to select the maximum size of returned chunks of data, the --pull-max-cnt general option can be used to control response chunk sizes.
In many cases it is important to the user to be able to monitor details of the operations executed against the WBEM server, either the APIs executed in pywbem, or the HTTP requests and responses and the time statistics for these operations.
The --log general option provides the capability to log information about this flow including:
The API calls and responses/exceptions executed by pywbem.
the HTTP requests and responses that pass between pywbemcli and the WBEM server.
The --log general option configures the logging including what is logged and the destination for the log output.
Thus, for example, the following command enumerates qualifiers and writes
the log entries for the CIM-XML HTTP requests and responses to the pywbemcli log
file pywbemcli.log
:
$ pywbemcli --output-format table --server http://localhost --log http=file qualifier enumerate
<displays table of qualifier declarations>
$ cat pywbemcli.log
2019-09-16 21:14:04,296-pywbem.http.1-21020-Connection:1-21020 WBEMConnection(url='http://localhost', ...)
2019-09-16 21:14:04,297-pywbem.http.1-21020-Request:1-21020 POST /cimom 11 http://localhost
CIMOperation:'MethodCall' CIMMethod:'EnumerateQualifiers' CIMObject:u'root/cimv2'
<?xml version="1.0" encoding="utf-8" ?>
<CIM CIMVERSION="2.0" DTDVERSION="2.0"><MESSAGE ID="1001" PROTOCOLVERSION="1.0">
...
</CIM>
. . .
Controlling output formats¶
Pywbemcli supports multiple output formats for command results by using the --output-format general option.
The output formats fall into several groups (table formats, CIM object formats, text formats, and a tree format); however, not all formats are supported or applicable for all commands. For more details, see Output formats.
Other miscellaneous general options¶
The --verbose general option displays extra information about the pywbemcli internal processing.
The --warn general option controls the display of warnings.
The --version general option displays pywbemcli version information and the --help general option provides top level help
General options descriptions¶
This section defines in detail the requirements, characteristics, and any special syntax of each general option.
--server
general option¶
The argument value of the --server
/-s
general option is a string that is
the URL of the WBEM server to which pywbemcli will connect, in the format:
[SCHEME://]HOST[:PORT]
Where:
SCHEME: The protocol to be used. Must be “https” or “http”. Default: “https”.
HOST: The WBEM server host. Must be a short hostname, fully qualified DNS hostname, literal IPv4 address, or literal IPv6 address. See RFC3986 and RFC6874 for details.
PORT: The WBEM server port to be used. Default: 5988 for HTTP, and 5989 for HTTPS.
This option is mutually exclusive with the --name general option and the --mock-server general option since each defines a connection to a WBEM server.
In the interactive mode the connection is not actually established until a command requiring access to the WBEM server is entered.
Examples for the argument value of this option include:
https://localhost:15345 # https, port 15345, hostname localhost
http://10.2.3.9 # http, port 5988, IPv4 address 10.2.3.9
https://10.2.3.9 # https, port 5989, IPv4 address 10.2.3.9
http://[2001:db8::1234-eth0] # http, port 5988, IPv6 address 2001:db8::1234, interface eth0
--name
general option¶
The argument value of the --name
/-n
general option is a string that is
the name of a connection definition in the connections file.
The parameters for this named connection definition will be loaded from the
connections file to become the current WBEM connection in pywbemcli.
In the interactive mode the connection is not actually established until a command requiring access to the WBEM server is entered.
This option is mutually exclusive with the --server general option and the --mock-server general option since each defines a connection to a WBEM server.
The following example creates a connection definition named myserver
in the connections file, and then uses that connection to execute
class get
:
$ pywbemcli --server http://localhost --user me --password mypw connection save myserver
$ pywbemcli --name myserver class get CIM_ManagedElement
<displays MOF for CIM_ManagedElement>
See connection command group for more information on managing connections.
--default-namespace
general option¶
The argument value of the --default-namespace
/-d
general option is a
string that defines the default CIM namespace to use for the target
WBEM server.
If this option is not specified, the default namespace will be root/cimv2
.
The default namespace will be used if the --namespace
/-n
command option
is not used on a command.
Some commands execute against multiple or all namespaces, for example the
the class find
command.
--user
general option¶
The argument value of the --user
/-u
general option is a string that is
the user name for authenticating with the WBEM server.
--password
general option¶
The argument value of the --password
/-p
general option is a string that
is the password for authenticating with the WBEM server.
This option is normally required if the --user general option is defined. If passwords are saved into the connections file, they are not encrypted in the file.
If the WBEM operations performed by any pywbemcli command require a password,
the password is prompted for if --user
/-u
is used (in both modes of
operation) and --password
/-p
is not used.
$ pywbemcli --server http://localhost --user me class get
Enter password: <password>
. . . <The display output from get class>
If both --user
/-u
and --password
/-p
are used, the command is
executed without a password prompt:
$ pywbemcli --server http://localhost --user me --password blah class get
. . . <The display output from get class>
If the operations performed by a particular pywbemcli command do not require a password or no user is supplied, no password is prompted. For example:
$ pywbemcli --help
. . . <help output>
For script integration, it is important to have a way to avoid the interactive password prompt. This can be done by storing the password string in an environment variable or specifying it on the command line. See Environment variables for general options.
The pywbemcli connection export command outputs the (bash/Windows) shell commands to set all needed environment variables.
The environment variable output is OS dependent. Thus for example in Unix type OSs:
$ pywbemcli --server http://localhost --user fred connection export
export PYWBEMCLI_SERVER=http://localhost
export PYWBEMCLI_NAMESPACE=root/cimv2
...
This ability can be used to set those environment variables and thus to persist the connection name in the shell environment, from where it will be used in any subsequent pywbemcli commands:
$ eval $(pywbemcli --server http://localhost --user fred connection export)
$ env | grep PYWBEMCLI
export PYWBEMCLI_SERVER=http://localhost
export PYWBEMCLI_NAMESPACE=root/cimv2
$ pywbemcli server namespaces
. . . <list of namespaces for the defined server>
--timeout
general option¶
The argument value of the --timeout
/-t
general option is an integer that
defines the
client side timeout in seconds. The pywbem client includes a timeout mechanism
that closes a WBEM connection if there is no response to a request to the WBEM
server in the time defined by this value. Pywbemcli defaults to a
predefined timeout (normally 30 seconds) if this option is not defined.
--verify
general option¶
The pair of --verify
and --no-verify
general options control whether or
not the client verifies any certificates received from the WBEM server.
By default or if --verify
is specified, any certificates returned by the
server are verified. If --no-verify
is specified, any certificates returned
by the server are accepted without verification.
This general option uses the approach with two long option names to allow the user to specifically enable or disable certificate verification when this general option is used in interactive mode.
--certfile
general option¶
The argument value of the --certfile
general option is the file path of a
PEM file containing a X.509 client certificate to be presented to the WBEM
server during the TLS/SSL handshake, enabling 2-way (mutual) authentication.
This option is used only with HTTPS.
If --certfile
is not used, no client certificate is presented to the server,
resulting in 1-way authentication during the TLS/SSL handshake.
For more information on authentication types, see: https://pywbem.readthedocs.io/en/stable/client/security.html#authentication-types
--keyfile
general option¶
The argument value of the --keyfile
general option is the file path of a
PEM file containing the private key belonging to the public key that is
part of the X.509 certificate. See --certfile general option for more
information.
Not required if the private key is part of the file defined in the
--certfile
option. --keyfile
is not allowed if --certfile
is not
provided. Default: No client key file. The client private key should then be
part of the file defined by --certfile
.
--ca-certs
general option¶
The argument value of the --ca-certs
general option specifies which
X.509 certificates are used on the client side for validating the X.509
certificate received from the WBEM server during SSL/TLS handshake when HTTPS
is used.
The client-side and server-side certificates may be CA certificates (i.e. certificates issued by a certificate authority) or self-signed certificates.
Its value must be one of:
The path name of a file in PEM format that contains one or more certificates. See the description of the ‘CAfile’ argument of the OpenSSL SSL_CTX_load_verify_locations() function for details.
The path name of a directory with files in PEM format, each of which contains exactly one certificate. The file names must follow a particular naming convention. See the description of the ‘CApath’ argument of the OpenSSL SSL_CTX_load_verify_locations() function for details.
The string ‘certifi’ (only for pywbem version 1.0 or later). This choice will cause the certificates provided by the certifi package to be used. That package provides the certificates from the Mozilla Included CA Certificate List. Note that this list only contains CA certificates, so this choice does not work if the WBEM server uses self-signed certificates.
The default behavior depends on the version of the installed pywbem package:
Starting with pywbem version 1.0, the default is the behavior described above for the string ‘certifi’.
Before pywbem version 1.0, the default is the path name of the first existing directory from a list of system directories where certificates are expected to be stored.
The version of the installed pywbem package can be displayed using the --version general option.
Specifying the --no-verify
option (see --verify general option)
bypasses client side verification of the WBEM server certificate.
--timestats
general option¶
The --timestats
/ --no-timestats
-T
general option is a boolean
option that enables the display of time statistics on the interactions with the
WBEM server.
When the option is included on the command line, the display of statistics is enabled after each command in the interactive mode and before exit in the command mode.
Statistics are always gathered in pywbemcli for the current connection for every
command executed. They can be displayed at any time in the interactive mode with
the command statistics show
.
For more information on statistics gathered by pywbemcli and WBEM servers see section statistics command group .
--use-pull
general option¶
The argument value of the --use-pull
/-u
general option determines
whether the pull operations or traditional operations are used for the
instance enumerate
, instance references
, instance associators
and instance query
commands. See
Pywbemcli and the DMTF pull operations for more information on pull
operations. The choices for the argument value are as follows:
yes
- pull operations will be used and if the server does not support pull, the request will fail.no
- forces pywbemcli to try only the traditional non-pull operations.either
- (default) pywbem tries both; first pull operations and then traditional operations.
--pull-max-cnt
general option¶
The argument value of the --pull-max-cnt
general option is an integer
passed to the WBEM server with the open and pull operation requests.
This integer tells the server the maximum number of objects
to be returned for each pull request if pull operations are used. This must
be a positive non-zero integer. The default is 1000. See Pywbemcli and the DMTF pull operations for more information on pull operations.
--mock-server
general option¶
The argument value of the --mock-server
/-m
general option is a file
path of a MOF file or Python script that loads a mock WBEM server in the
pywbemcli process with mock data (i.e. CIM objects).
This allows pywbemcli to be used without access to a real WBEM server.
This option may be specified multiple times.
This option may be specified multiple times to define multiple MOF and Python files that make up the definition of a mock server. The files must have the suffix “.mof” for MOF files and “.py” for Python scripts.
When this option is used, the security options (ex. --user
) are irrelevant;
they may be specified but are not used.
The following example creates a mock server with two files defining the mock
data, shows what parameters are defined for the connection, and then saves that
connection named mymockserver
:
$ pywbemcli --mock-server classdefs.mof --mock-server insts.py --default-namespace root/myhome
pywbemcli> connection show
name: not-saved (current)
server:
mock-server: classdefs.mof, insts.py
. . .
pywbemcli> connection save mymockserver
See chapter Mock WBEM server support for more information on defining the files for a mock server.
--output-format
general option¶
The argument value of the --output-format
/-o
general option is a string
that defines the output format in which the result of any pywbemcli commands
is displayed. The default output format depends on the command.
For details, see Output formats.
--log
general option¶
The argument value of the --log
/-l
general option defines the
destination and parameters of logging of the requests and responses to the WBEM
server.
For details, see Pywbemcli defined logging.
--verbose
general option¶
The --verbose
/-v
general option is a boolean option that enables the
display of extra information about the processing.
In particular it outputs text for a number of commands that normally return nothing upon successful execution(ex. instance delete, instance enumerate that returns no CIM objects) to indicate the successful command completion.
--connections-file
general option¶
The --connections-file
/-C
general option allows the user to select
a path name for the connections file.
By default, the path name of the connections file is the value of the
PYWBEMCLI_CONNECTIONS_FILE
environment variable or if not set, the file
.pywbemcli_connections.yaml
in the user’s home directory.
The user’s home directory depends on the operating system used and is
determined with os.path.expanduser("~")
, which works on all operating
systems including Windows. See expanduser()
for details.
The actually used path name of the connections file is shown in the connection list command.
The connection definitions in the connections file are managed with the commands in the connection command group.
In the interactive mode, this option may not be modified after the command line is processed.
--warn
general option¶
The --warn
/--no-warn
general option is a boolean option that controls
the display of all Python warnings.
If --warn
is used, all Python warnings are shown once. If --no-warn
is
used (default), the PYTHONWARNINGS
environment variable determines which
warnings are shown. If that variable is not set, no warnings are shown. See
PYTHONWARNINGS
for details.
--pdb
general option¶
The --pdb
general option is a boolean option that enables debugging
with the built-in pdb debugger.
If debugging is enabled, execution of the pywbemcli command will pause just before the command within pywbemcli is executed, and the pdb debugger prompt will appear. See pdb debugger commands for details on how to operate the built-in pdb debugger.
--version
general option¶
The --version
general option displays the version of the pywbemcli
command and the version of the pywbem package used by it, and then exits.
--help
general option¶
The --help
/-h
general option displays help text which describes the
command groups and general options, and then exits.
Environment variables for general options¶
Pywbemcli defines environment variables corresponding to its general options as follows:
Environment variable |
Corresponding general option |
---|---|
PYWBEMCLI_SERVER |
|
PYWBEMCLI_NAME |
|
PYWBEMCLI_USER |
|
PYWBEMCLI_PASSWORD |
|
PYWBEMCLI_OUTPUT_FORMAT |
|
PYWBEMCLI_DEFAULT_NAMESPACE |
|
PYWBEMCLI_TIMEOUT |
|
PYWBEMCLI_KEYFILE |
|
PYWBEMCLI_CERTFILE |
|
PYWBEMCLI_CA_CERTS |
|
PYWBEMCLI_USE_PULL |
|
PYWBEMCLI_PULL_MAX_CNT |
|
PYWBEMCLI_STATS_ENABLED |
|
PYWBEMCLI_MOCK_SERVER (1) |
|
PYWBEMCLI_LOG |
|
PYWBEMCLI_PDB |
|
PYWBEMCLI_CONNECTIONS_FILE |
|
Notes:
The
--mock-server
general option can be specified multiple times. To do that with the PYWBEMCLI_MOCK_SERVER environment variable, separate the multiple path names with space.
If these environment variables are set, the corresponding general options default to the value of the environment variables. If both an environment variable and its corresponding general option are set, the command line option overrides the environment variable with no warning.
Environment variables are not provided for command options or command arguments.
In the following example, the pywbemcli command uses server
http://localhost
defined by the environment variable:
$ export PYWBEMCLI_SERVER=http://localhost
$ pywbemcli class get CIM_ManagedElement
<displays MOF for CIM_ManagedElement>
The pywbemcli connection export command outputs the (bash/Windows) shell commands to set all of the environment variables:
$ pywbemcli --server http://localhost --user fred connection export
export PYWBEMCLI_SERVER=http://localhost
export PYWBEMCLI_NAMESPACE=root/cimv2
. . .
This can be used to set those environment variables and thus to persist the connection name in the shell environment, from where it will be used in any subsequent pywbemcli commands:
$ eval $(pywbemcli --server http://localhost --user fred)
$ env | grep PYWBEMCLI
export PYWBEMCLI_SERVER=http://localhost
export PYWBEMCLI_NAMESPACE=root/cimv2
. . .
$ pywbemcli server namespaces
. . . <list of namespaces for the defined server>
Pywbemcli and the DMTF pull operations¶
The DMTF specifications and pywbem includes two ways to execute the enumerate
instance type operations (Associators
, References
,
EnumerateInstances
, ExecQuery
):
The traditional operations (ex.
EnumerateInstances
)The pull operations (ex.
OpenEnumerateInstances
, etc.)
Pywbem implements an overlay of the above two operations called the Iter..
operations where each Iter..
operation executes either the traditional or
pull operation depending on a parameter of the connection.
While the pull operations may not be supported by all WBEM servers they can be significantly more efficient for large responses when they are available. Pywbem implements the client side of these operation and pywbemcli provides for the use of these operations through two general options:
--use-pull
- This option allows the user to select from the the following alternatives:either
- (default) pywbemcli first tries the open operation and if that is not implemented by the server retries the operation with the corresponding traditional operation. The result of this first operation determines whether pull or the traditional operation are used for any further requests during the current pywbem interactive session.yes
- Forces the use of the pull operations and fails if that is not implemented by the server.no
- Forces the use of the traditional operation.
--pull-max-cnt
- Sets the maximum count of objects the server is allowed to return for each open/pull operation. The default is 1000 objects which from experience is a logical choice.
The default alternative either
is probably the most logical setting for
--use-pull
, unless you are specifically testing the use of pull
operations.
However, there are some limitations with using the either
choice as follows:
The original operations did not support the filtering of responses with a query language query (
--filter-query-language
and--filter-query
) which requests that the WBEM server filter the responses before they are returned. This can greatly reduce the size of the responses if effectively used but is used only when the pull operations are available on the server.The pull operations do not support some of the options that traditional operations do:
--include-qualifiers
- Since even the traditional operations specification deprecated this option and the user cannot depend on it being honored, the most logical solution is to never use this option.--local-only
- Since even the traditional operations specification deprecated this option and the user cannot depend on it being honored by the WBEM server, the most logical solution is to never use this option.
The following example forces the use of the pull operations and expects the WBEM server to return no more than 10 instances per request. It fails if the pull operations are not supported in the WBEM server:
$ pywbemcli --server http://localhost --use-pull=yes --pull-max-cnt=10 instance enumerate CIM_Foo
Output formats¶
Pywbemcli supports multiple output formats to present command results. The output format can be selected with the --output-format general option. The allowed output formats are different for the various command groups and commands.
The output formats fall into several groups:
Table formats - The Table formats format the result as a table with rows and columns. Many of the result types allow table formatted response display including:
instance get
,instance enumerate
,instance references
,instance associators
where the table formats are alternatives to the CIM model formats that shows the properties for each instance as a column in a table.instance count
server
commandsclass find
connection
commands
CIM object formats - The CIM object formats format a result that consists of CIM objects in MOF, CIM-XML or pywbem repr format. All of the commands that return CIM objects support these output formats.
ASCII tree format - The ASCII tree format formats the result as a tree, using ASCII characters to represent the tree to show the hierarchial relationship between CIM classes. The only command supporting the ASCII tree format is
class tree
, and it supports only that one output format. The tree format is not supported by any other command today.TEXT format - The Text formats is used for commands that output small quantites of text (ex. the interop namespace name) and that could be used as part of a command line redirection.
When an unsupported output format is specified for a command response, it is
rejected with an exception. For example, the command class enumerate
only
supports the CIM object formats and will generate an exception if the
command pywbemcli -o table class enumerate
is entered.
Output formats for groups and commands¶
Each of the commands may allow only a subset of the possible ouput formats. Thus, the server brand only outputs data in a table format so there is no defined default format for the --output-format general option.
The following shows the default format for each command and the alternate formats where the values mean:
objects: xml
, repr
, or txt
table: table
, plain
, simple
, grid
, psql
, rst
, text
,
or html
Group |
Command |
Default |
Alternates |
Comments |
---|---|---|---|---|
class |
associators |
‘mof’ |
objects |
See Note 1 below |
class |
delete |
None |
None |
Nothing returned |
class |
enumerate |
‘mof’ |
objects |
See Note 1 below |
class |
find |
‘simple’ |
table |
|
class |
get |
‘mof’ |
objects |
See Note 1 below |
class |
invokemethod |
‘mof’ |
objects |
See Note 1 below |
class |
references |
‘mof’ |
objects |
See Note 1 below |
class |
tree |
None |
None |
Only outputs as ascii tree |
instance |
associators |
‘mof’ |
objects, table |
Output as cim object or table of properties |
instance |
count |
‘simple’ |
table |
|
instance |
create |
None |
None |
Nothing returned |
instance |
delete |
None |
None |
Nothing returned |
instance |
enumerate |
‘mof’ |
objects, table |
|
instance |
get |
‘mof’ |
objects, table |
|
instance |
invokemethod |
‘mof’ |
objects, table |
|
instance |
modify |
None |
None |
Nothing returned |
instance |
references |
‘mof’ |
table |
|
qualifier |
enumerate |
‘mof’ |
table |
|
qualifier |
get |
‘mof’ |
table |
|
server |
brand |
‘text’ |
text |
Alternate is table format |
server |
centralinsts |
‘simple’ |
table |
|
server |
info |
‘simple’ |
table |
|
server |
interop |
‘text’ |
text |
Alternate is table format |
server |
namespaces |
‘simple’ |
table |
Alternate is text format |
server |
profiles |
‘simple’ |
table |
|
connection |
delete |
None |
table |
|
connection |
export |
None |
table |
|
connection |
list |
‘simple’ |
table |
|
connection |
save |
None |
table |
|
connection |
select |
None |
None |
|
connection |
show |
None |
None |
Currently ignores output format |
connection |
test |
None |
None |
NOTES:
The display of classes with the
--names-only
/--no
or--summary
/-s
command options allows table output formats in addition to the objects output formats.
Table formats¶
The different variations of the table format define different formatting of the
borders for tables. The following are examples of the table formats with a
single command class find CIM_Foo
:
--output-format table
: Tables with a single-line border. This is the default:Find class CIM_Foo* +-------------+-----------------+ | Namespace | Classname | |-------------+-----------------| | root/cimv2 | CIM_Foo | | root/cimv2 | CIM_Foo_sub | | root/cimv2 | CIM_Foo_sub2 | | root/cimv2 | CIM_Foo_sub_sub | +-------------+-----------------+
--output-format simple
: Tables with a line between header row and data rows, but otherwise without borders:Find class CIM_Foo* Namespace Classname ----------- --------------- root/cimv2 CIM_Foo root/cimv2 CIM_Foo_sub root/cimv2 CIM_Foo_sub2 root/cimv2 CIM_Foo_sub_sub
--output-format plain
: Tables do not use any pseudo-graphics to draw borders:Find class CIM_Foo* Namespace Classname root/cimv2 CIM_Foo root/cimv2 CIM_Foo_sub root/cimv2 CIM_Foo_sub2 root/cimv2 CIM_Foo_sub_sub
--output-format grid
: Tables tables formatted by Emacs’ table.el package. It corresponds togrid_tables
in Pandoc Markdown extensions:Find class CIM_Foo* +-------------+-----------------+ | Namespace | Classname | +=============+=================+ | root/cimv2 | CIM_Foo | +-------------+-----------------+ | root/cimv2 | CIM_Foo_sub | +-------------+-----------------+ | root/cimv2 | CIM_Foo_sub2 | +-------------+-----------------+ | root/cimv2 | CIM_Foo_sub_sub | +-------------+-----------------+
--output-format rst
: Tables in reStructuredText markup:Find class CIM_Foo* =========== =============== Namespace Classname =========== =============== root/cimv2 CIM_Foo root/cimv2 CIM_Foo_sub root/cimv2 CIM_Foo_sub2 root/cimv2 CIM_Foo_sub_sub =========== ===============
--output-format psql
: Like tables formatted by Postgres’ psql cli:Find class CIM_Foo* =========== =============== Namespace Classname =========== =============== root/cimv2 CIM_Foo root/cimv2 CIM_Foo_sub root/cimv2 CIM_Foo_sub2 root/cimv2 CIM_Foo_sub_sub =========== ===============
--output-format html
: Tables formatted as html table:<p>Find class CIM_Foo*</p> <table> <thead> <tr><th>Namespace </th><th>Classname </th></tr> </thead> <tbody> <tr><td>root/cimv2 </td><td>CIM_Foo </td></tr> <tr><td>root/cimv2 </td><td>CIM_Foo_sub </td></tr> <tr><td>root/cimv2 </td><td>CIM_Foo_sub2 </td></tr> <tr><td>root/cimv2 </td><td>CIM_Foo_sub_sub</td></tr> </tbody> </table>
CIM object formats¶
The output of CIM objects allows multiple formats as follows:
--output-format mof
: Format for CIM classes, CIM instances, and CIM Parameters.MOF is the format used to define and document the CIM models released by the DMTF and SNIA. It textually defines the components and structure and data of CIM elements such as classes, instances, and qualifier declarations:
instance of CIM_Foo { InstanceID = "CIM_Foo1"; IntegerProp = 1; };
--output-format xml
: CIM-XML format for CIM elements such as classes, instances and qualifier declarations. Besides being used as a protocol for WBEM servers, CIM-XML is also an alternative format for representing the CIM models released by the DMTF and SNIA. The XML syntax is defined in the DMTF specification DSP0201.This is the format used in the DMTF CIM-XML protocol:
<VALUE.OBJECTWITHLOCALPATH> <LOCALINSTANCEPATH> <LOCALNAMESPACEPATH> <NAMESPACE NAME="root"/> <NAMESPACE NAME="cimv2"/> </LOCALNAMESPACEPATH> <INSTANCENAME CLASSNAME="CIM_Foo"> <KEYBINDING NAME="InstanceID"> <KEYVALUE VALUETYPE="string">CIM_Foo1</KEYVALUE> </KEYBINDING> </INSTANCENAME> </LOCALINSTANCEPATH> <INSTANCE CLASSNAME="CIM_Foo"> <PROPERTY NAME="InstanceID" PROPAGATED="false" TYPE="string"> <VALUE>CIM_Foo1</VALUE> </PROPERTY> <PROPERTY NAME="IntegerProp" PROPAGATED="false" TYPE="uint32"> <VALUE>1</VALUE> </PROPERTY> </INSTANCE> </VALUE.OBJECTWITHLOCALPATH>
--output-format repr
: Python repr format of the objects.This is the structure and data of the pywbem Python objects representing these CIM objects and can be useful in understanding the pywbem interpretation of the CIM objects:
CIMInstance(classname='CIM_Foo', path=CIMInstanceName(classname='CIM_Foo', keybindings=NocaseDict({'InstanceID': 'CIM_Foo1'}), namespace='root/cimv2', host=None), properties=NocaseDict({ 'InstanceID': CIMProperty(name='InstanceID', value='CIM_Foo1', type='string', reference_class=None, embedded_object=None, is_array=False, array_size=None, class_origin=None, propagated=False, qualifiers=NocaseDict({})), 'IntegerProp': CIMProperty(name='IntegerProp', value=1, type='uint32', reference_class=None, embedded_object=None, is_array=False, array_size=None, class_origin=None, propagated=False, qualifiers=NocaseDict({}))}), property_list=None, qualifiers=NocaseDict({}))
NOTE: The above is output as a single line and has been manually formatted for this documentation.
--output-format txt
: Python str format of the objects.This should be considered the output of last resort as it simply uses the
__str__()
method of the Python class for each CIM object to output.Thus, for example, a
class enumerate
command of a model with only a single class creates output of the form:CIMClass(classname='CIM_Foo', ...)
ASCII tree format¶
This output format is an ASCII based output that shows the tree structure of
the results of the class tree
command. It is the only output format
supported by this command, and therefore it is automatically selected and
cannot be specified explicitly with the --output-format general option.
$ pywbemcli --mock-server tests/unit/simple_mock_model.mof class tree
root
+-- CIM_Foo
+-- CIM_Foo_sub
| +-- CIM_Foo_sub_sub
+-- CIM_Foo_sub2
This shows a very simple mock repository with 4 classes where CIM_Foo is the top level in the hierarchy, CIM_Foo_sub and CIM_Foo_sub2 are its subclasses, and CIM_Foo_sub_sub is the subclass of CIM_Foo_sub.
Text formats¶
The TEXT format group outputs the data returned from the command as text to the console without any formatting except for formatting lists and comma separated strings. It is useful for use with data that might be redirected to other commands or output that is simple enough that a single line of output is sufficient.
$ pywbemcli --mock-server tests/unit/testmock/wbemserver_mock.py -o table server namespaces
Server Namespaces:
Namespace Name
----------------
interop
$ pywbemcli --mock-server tests/unit/testmock/wbemserver_mock.py -o text server namespaces
interop
Pywbemcli defined logging¶
Pywbemcli provides logging to either a file or the standard error stream of information passing between the pywbemcli client and a WBEM server using the standard Python logging facility.
Logging is configured and enabled using the --log general option on the commmand line or the PYWBEMCLI_LOG environment variable.
Pywbemcli can log operation calls that send requests to a WBEM server and their responses and the HTTP messages between the pywbemcli client and the WBEM server including both the pywbem APIs and their responses and the HTTP requests and responses.
The default is no logging if the --log
option is not specified.
The argument value of the --log
option and the value of the PYWBEMCLI_LOG
environment variable is a log configuration string with the format defined in
the ABNF rule LOG_CONFIG_STRING
, below. The log configuration string
defines a list of
one or more log configurations, each with fields COMPONENT
, DESTINATION
,
and DETAIL
:
LOG_CONFIG_STRING := CONFIG [ "," CONFIG ]
CONFIG := COMPONENT [ "=" DESTINATION [ ":" DETAIL ]]
COMPONENT := ( "all" / "api" / "http" )
DESTINATION := ( "stderr" / "file" )
DETAIL := ( "all" / "path" / "summary" )
For example the following log configuration string logs the pywbem API calls and writes summary information to a log file and the HTTP requests and responses to stderr:
$ pywbemcli --log api=file:summary,http=stderr
The simplest log configuration string to enable logging is all=stderr
or
all=file
.
The COMPONENT
field defines the component for which logging is enabled:
api
- Logs the calls to the pywbem methods that make requests to a WBEM server. This logs both the requests and response including any exceptions generated by error responses from the WBEM server.http
- Logs the headers and data for HTTP requests and responses to the WBEM server.all
- (Default) Logs both theapi
andhttp
components.
The DESTINATION
field specifies the log destination:
stderr
- Output log to stderr.file
- (default) Log to the pywbemcli log filepywbemcli.log
in the current directory. Logs are appended to an existing log file.
The DETAIL
component of the log configuration string defines the level of
logging information for the api and http components. Because enormous quantities
of information can be generated this option exists to limit the amount of
information generated. The possible keywords are:
all
- (Default) Logs the full request including all input parameters and the complete response including all data. Exceptions are fully logged.paths
- Logs the full request but only the path component of the api responses. This reduces the data included in the responses. Exceptions are fully logged.summary
- Logs the requests but only the count of objects received in the response. Exceptions are fully logged.
The log output is routed to the output defined by DESTINATION
and includes the
information determined by the COMPONENT
and DETAIL
fields.
The log output format is:
<Date time>-<Component>.<connection id>-<Direction>:<connection id> <PywbemOperation>(<data>)
For example, logging only of the summary API information would look something like the following:
$ pywbemcli -s http://localhost -u blah -p pw -l api=file:summary class enumerate -o
produces log output for the class enumerate operation in the log file
pywbemcli.log as follows showing the input parameters to the pywbem method
EnumerateClassName
and the number of objects in the response:
2019-07-09 18:27:22,103-pywbem.api.1-27716-Request:1-27716 EnumerateClassNames(ClassName=None, DeepInheritance=False, namespace=None)
2019-07-09 18:27:22,142-pywbem.api.1-27716-Return:1-27716 EnumerateClassNames(list of str; count=103)
Pywbemcli persisted connection definitions¶
Pywbemcli can manage persisted connection definitions via the
connection command group. These connection definitions are persisted in
a connections file named .pywbemcli_connections.yaml
in
the user’s home directory. A connection definition has a name
and defines all parameters necessary to connect to a WBEM server. Once defined
these connection definitions can be used with the --name general option
or in the interactive mode by defining a current connection with the
connection select command.
A new persistent connection definition can be created with the connection save command.
At any point in time, pywbemcli can communicate with only a single WBEM server.
That is the current connection.
In the command mode, this is the WBEM server defined by the general options
--server
or --mock-server
or --name
. In the interactive mode, the
current connection can be changed within an interactive session using the
connection select command so that within a single session, the user can
work with multiple WBEM servers (at different points in time).
The following example creates a persisted connection definition, using interactive mode:
$ pywbemcli
pywbemcli> --server http://localhost --user usr1 --password blah connection save testconn
pywbemcli> connection list
WBEM server connections: (#: default, *: current)
+-----------+------------------+-------------+--------+-----------+----------+----------------------------------------+
| name | server | namespace | user | timeout | verify | mock-server |
|-----------+------------------+-------------+--------+-----------+----------+----------------------------------------|
| testconn | http://localhost | root/cimv2 | usr1 | 30 | True | |
+-----------+------------------+-------------+--------+-----------+----------+----------------------------------------+
Since the connection definition is persisted, it is available in command mode as well as in new interactive sessions:
$ pywbemcli connection list
WBEM server connections: (#: default, *: current)
+-----------+------------------+-------------+--------+-----------+----------+----------------------------------------+
| name | server | namespace | user | timeout | verify | mock-server |
|-----------+------------------+-------------+--------+-----------+----------+----------------------------------------|
| testconn | http://localhost | root/cimv2 | usr1 | 30 | True | |
+-----------+------------------+-------------+--------+-----------+----------+----------------------------------------+
$ pywbemcli
pywbemcli> connection list
WBEM server connections: (#: default, *: current)
+-----------+------------------+-------------+--------+-----------+----------+----------------------------------------+
| name | server | namespace | user | timeout | verify | mock-server |
|-----------+------------------+-------------+--------+-----------+----------+----------------------------------------|
| testconn | http://localhost | root/cimv2 | usr1 | 30 | True | |
+-----------+------------------+-------------+--------+-----------+----------+----------------------------------------+
Other connection definitions can be added, this time using command mode:
$ pywbemcli --server http://blah2 --user you --password xxx connection save Ronald
$ pywbemcli connection list
WBEM server connections: (#: default, *: current)
+-----------+------------------+-------------+--------+-----------+----------+----------------------------------------+
| name | server | namespace | user | timeout | verify | mock-server |
|-----------+------------------+-------------+--------+-----------+----------+----------------------------------------|
| Ronald | http://blah2 | root/cimv2 | you | 30 | True | |
| testconn | http://localhost | root/cimv2 | usr1 | 30 | True | |
+-----------+------------------+-------------+--------+-----------+----------+----------------------------------------+
The following example shows how to select current connections in interactive
mode. Note the marker *
in front of the name, which indicates the current
connection. The connection show command when used without a connection
name shows the current connection:
$ pywbemcli
pywbemcli> connection select Ronald
pywbemcli> connection list
WBEM server connections: (#: default, *: current)
+-----------+------------------+-------------+--------+-----------+----------+----------------------------------------+
| name | server | namespace | user | timeout | verify | mock-server |
|-----------+------------------+-------------+--------+-----------+----------+----------------------------------------|
| *Ronald | http://blah2 | root/cimv2 | you | 30 | True | |
| testconn | http://localhost | root/cimv2 | usr1 | 30 | True | |
+-----------+------------------+-------------+--------+-----------+----------+----------------------------------------+
pywbemcli> connection show
name: Ronald (current)
server: http://blah2
mock-server:
. . .
pywbemcli> connection select testconn
pywbemcli> connection list
WBEM server connections: (#: default, *: current)
+-----------+------------------+-------------+--------+-----------+----------+----------------------------------------+
| name | server | namespace | user | timeout | verify | mock-server |
|-----------+------------------+-------------+--------+-----------+----------+----------------------------------------|
| Ronald | http://blah2 | root/cimv2 | you | 30 | True | |
| *testconn | http://localhost | root/cimv2 | usr1 | 30 | True | |
+-----------+------------------+-------------+--------+-----------+----------+----------------------------------------+
pywbemcli> connection show
name: testconn (current)
server: http://localhost
mock-server:
. . .
pywbemcli> connection show Ronald
name: Ronald
server: http://blah2
mock-server:
. . .
The concept of a current connection that can be selected is useful mostly for
the interactive mode. In command mode, the connection specified with one of the
-server
, --mock-server
, or --name
general options automatically is
considered the current connection, and there is no concept of selecting a
current connection other than using these options.
Therefore, pywbemcli additionally supports the concept of a persisted default
connection.
The following example defines a persisted default connection and then uses it in command mode:
$ pywbemcli connection select Ronald --default
"Ronald" default and current
$ pywbemcli connection list
WBEM server connections: (#: default, *: current)
+-----------+------------------+-------------+--------+-----------+----------+----------------------------------------+
| name | server | namespace | user | timeout | verify | mock-server |
|-----------+------------------+-------------+--------+-----------+----------+----------------------------------------|
| #Ronald | http://blah2 | root/cimv2 | you | 30 | True | |
| testconn | http://localhost | root/cimv2 | usr1 | 30 | True | |
+-----------+------------------+-------------+--------+-----------+----------+----------------------------------------+
$ pywbemcli connection show
name: Ronald (default, current)
server: http://blah2
mock-server:
. . .
Connections can be deleted with the connection delete
command either with
the command argument containing the connection name or with no name provided so
pywbemcli presents a list of connections to choose from:
$ pywbemcli connection delete Ronald
Deleted default connection "Ronald".
or:
$ pywbemcli connection delete
Select a connection or CTRL_C to abort.
0: Ronald
1: testconn
Input integer between 0 and 1 or Ctrl-C to exit selection: 0
Deleted default connection "Ronald".
Pywbemcli special command line features¶
Pywbemcli includes several features in the command syntax that are worth presenting in detail to help the user understand the background, purpose and syntactic implementation of the features. This includes:
The ability to receive either CIM instances or classes or only their names with only a change of an option on the commands that request CIM instances or classes. The
--names-only
/--no
command option defines whether only the name or the complete object will be displayed.The ability to define complete INSTANCE name command arguments or interactively select the instance namesfrom a list presented by pywbemcli for certain objects rather than typing in long names the full name. see Specifying the INSTANCENAME command argument.
pywbemcli commands to WBEM operations¶
The following table defines which pywbemcli commands are used for the corresponding WBEM operations.
WBEM CIM-XML Operation |
pywbemcli command group & command |
---|---|
Instance Operations: |
|
EnumerateInstances |
instance enumerate INSTANCENAME |
EnumerateInstanceNames |
instance enumerate INSTANCENAME –names-only |
GetInstance |
instance get INSTANCENAME |
ModifyInstance |
instance modify |
CreateInstance |
instance create |
DeleteInstance |
instance delete INSTANCENAME |
Associators(instance) |
instance associators INSTANCENAME |
Associators(class) |
class associators CLASSNAME |
AssociatorNames(instance) |
instance associators INSTANCENAME –names-only |
AssociatorNames(class) |
class associators CLASSNAME –names-only |
References(instance) |
instance references INSTANCENAME |
References(class) |
class references CLASSNAME |
ReferenceNames(instance) |
instance references INSTANCENAME –names-only |
ReferenceNames(class) |
class references CLASSNAME –names-only |
InvokeMethod |
instance invokemethod INSTANCENAME –names-only |
ReferenceNames |
class invokemethod CLASSNAME –names-only |
ExecQuery |
instance query |
Pull Operations: |
Option –use-pull |
OpenEnumerateInstances |
instance enumerate INSTANCENAME |
OpenEnumerateInstancePaths |
instance enumerate INSTANCENAME –names-only |
OpenAssociatorInstances |
instance associators INSTANCENAME |
OpenAssociatorInstancePaths |
instance associators INSTANCENAME –names-only |
OpenReferenceInstances |
instance references INSTANCENAME |
OpenReferenceInstancePaths |
instance references INSTANCENAME –names-only |
OpenQueryInstances |
instance references INSTANCENAME –names-only |
PullInstancesWithPath |
part of pull sequence |
PullInstancePaths |
part of pull sequence |
PullInstances |
part of pull sequence |
CloseEnumeration |
Not implemented |
Class Operations: |
|
EnumerateClasses |
class enumerate CLASSNAME |
EnumerateClassNames |
class enumerate –names-only |
GetClass |
class get CLASSNAME |
ModifyClass |
Not implemented |
CreateClass |
Not implemented |
DeleteClass |
class delete CLASSNAME |
QualifierDeclaration ops: |
|
EnumerateQualifiers |
qualifier enumerate |
GetQualifier |
qualifier get QUALIFIERNAME |
SetQualifier |
Not implemented |
DeleteQualifier |
Not Implemented |
Specifying CIM property and parameter values¶
The instance create command, instance modify command, class invokemethod command, and instance invokemethod command define the values of properties and parameters that are to be applied to CIM instances and methods to be sent to the WBEM server.
For a single property or parameter these are the --property
/-p
or
--parameter
/-p
command options with name and value in the form:
--property <name>=<value>
--parameter <name>=<value>
-p <name>=<value>
Where:
<name> is the name of the of the property or parameter.
<value> is the value of the property or parameter. The values represent the value of CIM types (ex. Uint32, String, etc.) or arrays of these types.
value := scalarValue | or arrayValues
arrayValues := scalarValue [ "," scalarValue]
scalarValue := integerValue, realValue, charValue, stringValue,
datetimeValue, booleanValue, nullValue, objectPath of
ANNEX A :term:`DSP0004`
These values define the syntax of the values to build CIM properties and CIM parameters to be sent to the CIM Server. Since the WBEM server requires that each property/parameter be typed to be created, pywbemcli retrieves the target CIM class from the WBEM Server to determine the CIM type and arrayness required to define a CIMProperty.
The scalarValues limitations with respect to the definitions in DSP0004 include:
Only decimal integers are allowed (octal, hex, and binary are not supported).
Integers must be in the value range of the corresponding CIM type (ex. Uint32) defined in the class to which the property is being applied.
The format for objectPath is the WBEM URI as defined in Specifying the INSTANCENAME command argument
Quotes around the value are only required if the value includes whitespace. See backslash-escaped for information on use of backslashes in formating property and parameter argument values.
The following are examples of scalar property definitions:
-p p1=SomeText
-p p2=\"Text with space\"
-p pint=3
-p psint=-3
For array properties the values are defined separated by commas:
-p <property-name>=<value>(,<value>)
For example:
-p strarray=abc,def,ghjk
-p strarray2=\"ab c\",def
Displaying CIM instances/classes or their names¶
The pywbem API includes different WBEM operations (ex. EnumerateInstances
,
EnumerateInstanceNames
, EnumerateClasses
, and EnumerateClassNames
)
to request CIM objects or just their names. To simplify the overall command
line syntax pywbemcli combines these into a single command (i.e. enumerate
,
references
, associators
) in the class command group and the
instance command group and includes the
--names-only
/--no
command option that determines whether the names or
the CIM objects are retrieved from the WBEM server.
Thus, for example an instance enumerate
command with and without the
--names-only
/--no
option:
$ pywbemcli --mock-server tests/unit/simple_mock_model.mof instance enumerate CIM_Foo
instance of CIM_Foo {
InstanceID = "CIM_Foo1";
IntegerProp = 1;
};
instance of CIM_Foo {
InstanceID = "CIM_Foo2";
IntegerProp = 2;
};
instance of CIM_Foo {
InstanceID = "CIM_Foo3";
};
$ pywbemcli --mock-server tests/unit/simple_mock_model.mof instance enumerate CIM_Foo --names-only
root/cimv2:CIM_Foo.InstanceID="CIM_Foo1"
root/cimv2:CIM_Foo.InstanceID="CIM_Foo2"
root/cimv2:CIM_Foo.InstanceID="CIM_Foo3"
Specifying the INSTANCENAME command argument¶
The INSTANCENAME argument used by some pywbemcli commands (e.g instance get
)
specifies the instance path (aka instance name) of a CIM instance in a CIM
namespace of a WBEM server.
The instance name (INSTANCENAME argument) can be specified in two ways:
By specifying a complete untyped WBEM URI as defined in section The INSTANCENAME command argument as a WBEM URI. The namespace of the instance is the namespace specified in the WBEM URI, or the namespace specified with the
--namespace
/-n
command option, or the default namespace of the connection. Any host name in the WBEM URI will be ignored.By specifying the WBEM URI with the wildcard “?” in place of the keys component of the WBEM URI, as defined in section Interactively selecting INSTANCENAME command argument (i.e. CLASSNAME.?). The namespace of the instance is the namespace specified with the
--namespace
/-n
command option, or the default namespace of the connection. If there is only a single instance, that instance is selected automaticaly with without user request.By specifying the WBEM URI without keybindings and using the
--key
/-k
command option to specify the keybindings ad defined in section Defining INSTANCENAME command argument with –key option. The advantage of this technique is that it eliminates the use of the double quote surrounding the key values.
The INSTANCENAME command argument as a WBEM URI¶
The format used by pywbemcli for specifying complete INSTANCENAME arguments on
the command line is an untyped WBEM URI for instance paths as defined in
DSP0207, this is the standard format. There is also a historical
format for WBEM URIs that is described in the
pywbem.CIMInstanceName.to_wbem_uri()
method.
The INSTANCENAME argument can be specified using the standard format or the historical format.
Because pywbemcli always works with a single WBEM server at a time, the authority component of the WBEM URI does not need to be specified in an INSTANCENAME argument. Because the namespace type of the WBEM URI (e.g. “http” or “https”) is not relevant for identifying the CIM instance, the namespace type does not need to be specified in an INSTANCENAME argument.
With these simplifications and using the (simpler) historical format, the format for the INSTANCENAME argument can be described by the following ABNF:
INSTANCENAME = [ NAMESPACE ":" ] CLASSNAME [ "." keybindings ]
keybindings = keybinding *( "," keybinding )
keybinding = PROPERTYNAME "=" value
value = integerValue / charValue / stringValue / datetimeValue / booleanValue / referenceValue
referenceValue = "\"" escaped_INSTANCENAME "\""
where:
NAMESPACE, CLASSNAME and PROPERTYNAME are namespace, class and key property name, respectively, as used elsewhere in pywbemcli.
The namespace, if specified, must be the target namespace of the operation. The purpose of being able to specify a namespace in INSTANCENAME is not to override the target namespace, but to use returned instance names that may contain a namespace, unchanged.
integerValue, charValue, stringValue, datetimeValue and booleanValue are defined in ANNEX A of DSP0004.
Note that stringValue and datetimeValue when used in INSTANCENAME have exactly one set of surrounding double quotes (i.e. they cannot be constructed via string concatenation).
Note that charValue when used in INSTANCENAME has exactly one set of surrounding single quotes.
Note that DSP0004 prevents the use of real32 or real64 typed properties as keys.
escaped_INSTANCENAME is a backslash-escaped INSTANCENAME where at least backslash and double quote characters are backslash-escaped
Examples for UNIX-like shells. See backslash-escaped for information on use of backslashes:
pywbemcli instance get root/cimv2:MY_Foo.ID=42
pywbemcli instance get MY_Foo.ID=42
pywbemcli instance get "MY_Foo.CharKey='x'"
pywbemcli instance get 'MY_Foo.InstanceID="foo1"'
pywbemcli instance get "MY_Foo.InstanceID=\"$value\""
pywbemcli instance get 'MY_CS.CreationClassName="MY_CS",Name="MyComp"'
pywbemcli instance get 'MY_LogEntry.Timestamp="20190901183853.762122+120"'
Examples for Windows command processor:
pywbemcli instance get root/cimv2:MY_Foo.ID=42
pywbemcli instance get MY_Foo.ID=42
pywbemcli instance get MY_Foo.CharKey='x'
pywbemcli instance get MY_Foo.InstanceID="foo1"
pywbemcli instance get MY_Foo.InstanceID="%value%"
pywbemcli instance get MY_CS.CreationClassName="MY_CS",Name="MyComp"
pywbemcli instance get MY_LogEntry.Timestamp="20190901183853.762122+120"
Interactively selecting INSTANCENAME command argument¶
To simplify creating the INSTANCENAME argument on the command line, pywbemcli provides a wildcard character “?” that can be used in the INSTANCENAME argument in place of the keybindings component of the WBEM URI.
If an INSTANCENAME argument specifies the wildcard key, pywbemcli performs an interactive selection of the instance name by enumerating the instance names of the specified class, displaying the list of instance names along with index numbers, and prompting the user for the index number of the instance name to be used.
The ABNF for the INSTANCENAME argument with a wildcard key is:
INSTANCENAME = CLASSNAME "." wildcard
wildcard = "?"
where:
CLASSNAME is a class name as used elsewhere in pywbemcli.
Thus, in place of the full WBEM URI (ex. CIM_Foo.InstanceID="CIM_Foo1"
),
the user specifies CIM_Foo.?
for the INSTANCENAME argument to trigger the
interactive selection, as shown in the following example:
$ pywbemcli --mock-server tests/unit/simple_mock_model.mof instance get CIM_Foo.?
Pick Instance name to process
0: root/cimv2:CIM_Foo.InstanceID="CIM_Foo1"
1: root/cimv2:CIM_Foo.InstanceID="CIM_Foo2"
2: root/cimv2:CIM_Foo.InstanceID="CIM_Foo3"
Input integer between 0 and 2 or Ctrl-C to exit selection: 0 << user enters 0
instance of CIM_Foo {
InstanceID = "CIM_Foo1";
IntegerProp = 1;
};
Defining INSTANCENAME command argument with –key option¶
The INSTANCENAME may be specified by a combination of the namespace/classname
as an argument with the --key
/-k
command option to define keybindings.
Each --key
/-k
option definition defines a single keybinding in the form
name=value
.
In general, the value component does not require the double quote that is
required with the WBEM URI format unless there are space characters in a string
value.
Example:
CIM_Foo --key InstanceId=inst1
Pywbemcli command groups and commands¶
This section defines the characteristics of each of the pywbemcli command groups and commands including examples.
For the command line syntax of pywbemcli using these command groups and commands, see Pywbemcli command line interface.
NOTE: Many of the examples below use the --mock-server general option
with mock files that are located in the pywbemtools tests/unit
subdirectory.
The command groups are:
class command group - Command group for CIM classes.
instance command group - Command group for CIM instances.
namespace command group - Command group for Namespace management.
profile command group - Command group for WBEM management profiles.
qualifier command group - Command group for CIM qualifier declarations.
server command group - Command group for WBEM servers.
statistics command group - Command group for WBEM operation statistics.
connection command group - Command group for WBEM connection definitions.
The individual commands (no command group) are: * help command - Show help message for interactive mode. * repl command - Enter interactive mode (default).
namespace
command group¶
The namespace
command group has commands that act on CIM namespaces:
namespace list command - List the namespaces on the server.
namespace create command - Create a namespace on the server.
namespace delete command - Delete a namespace on the server.
namespace interop command - Get the Interop namespace on the server.
See pywbemcli namespace –help.
namespace list
command¶
The namespace list
command lists the namespaces of the WBEM server of
the current connection.
The result is displayed using txt
output format or
Table output formats.
The Interop namespace must exist on the server.
Example:
$ pywbemcli --name myserver --output-format plain namespace list
Namespace Name
root/PG_InterOp
root/benchmark
root/PG_Internal
test/WsmTest
test/EmbeddedInstance/Static
test/TestProvider
test/EmbeddedInstance/Dynamic
root/cimv2
root
test/cimv2
test/static
See pywbemcli namespace list –help for the exact help output of the command.
namespace create
command¶
The namespace create
command creates a CIM namespace on the WBEM server of
the current connection.
Leading and trailing slash (/
) characters specified in the NAMESPACE
argument will be stripped.
The namespace must not yet exist on the server.
The Interop namespace must exist on the server and cannot be created using this command.
WBEM servers may not allow this operation or may severely limit the conditions under which a namespace can be created on the server.
Example:
$ pywbemcli --name mymock namespace create /root/abc
Created namespace root/abc
See pywbemcli namespace create –help for the exact help output of the command.
namespace delete
command¶
The namespace delete
command deletes a CIM namespace from the WBEM server of
the current connection.
Leading and trailing slash (/
) characters specified in the NAMESPACE
argument will be stripped.
The namespace must exist and must be empty. That is, it must not contain any objects (qualifiers, classes or instances).
The Interop namespace must exist on the server and cannot be deleted using this command.
WBEM servers may not allow this operation or may severely limit the conditions under which a namespace can be deleted.
Example:
$ pywbemcli --name mymock namespace delete /root/abc
Deleted namespace root/abc
See pywbemcli namespace delete –help for the exact help output of the command.
namespace interop
command¶
The namespace interop
command gets and displays the Interop namespace of
the WBEM server of the current connection.
The Interop namespace must exist on the server.
Example:
$ pywbemcli --name mymock namespace interop
root/interop
See pywbemcli namespace interop –help for the exact help output of the command.
class
command group¶
The class
command group has commands that act on CIM classes:
class associators command - List the classes associated with a class.
class delete command - Delete a class.
class enumerate command - List top classes or subclasses of a class in a namespace.
class find command - List the classes with matching class names on the server.
class get command - Get a class.
class invokemethod command - Invoke a method on a class.
class references command - List the classes referencing a class.
class tree command - Show the subclass or superclass hierarchy for a class.
class associators
command¶
The class associators
command lists the CIM classes that are associated
with the specified source class.
The source class is named with the CLASSNAME
argument and is in the
namespace specified with the -namespace
/-n
command option, or otherwise
in the default namespace of the connection.
If the --names-only
/--no
command option is set, only the class path is
displayed, using CIM object output formats or
Table output formats. Otherwise, the class definition is displayed,
using CIM object output formats.
Note: This command returns class associations. The instance associators command returns instance associations.
Example:
$ pywbemcli --name mymock class associators TST_Person --names-only
//FakedUrl/root/cimv2:TST_Person
See pywbemcli class associators –help for the exact help output of the command.
class delete
command¶
The class delete
command deletes the specified class on the server.
The class is named with the CLASSNAME
argument and is in the
namespace specified with the -namespace
/-n
command option, or otherwise
in the default namespace of the connection.
If the class has subclasses, the command is rejected.
If the class has instances, the command is rejected, unless the --force
command option was specified, in which case the instances are also deleted.
WARNING: Deleting classes can cause damage to the server: It can impact instance providers and other components in the server. Use this command with caution.
Many WBEM servers may not allow this operation or may severely limit the conditions under which a class can be deleted from the server.
Example:
$ pywbemcli class delete CIM_Blah
See pywbemcli class delete –help for the exact help output of the command.
class enumerate
command¶
The class enumerate
command enumerates the subclasses of the specified
class, or the root classes of the class hierarchy.
If the CLASSNAME
argument is specified, the command enumerates the
subclasses of the class named with the CLASSNAME
argument in the
namespace specified with the -namespace
/-n
command option, or otherwise
in the default namespace of the connection.
If the CLASSNAME
argument is omitted, the command enumerates the top
classes of the class hierarchy in the namespace specified with the
-namespace
/-n
command option, or otherwise in the default namespace of
the connection.
If the --names-only
/--no
command option is set, only the class path is
displayed, using CIM object output formats or
Table output formats. Otherwise, the class definition is displayed,
using CIM object output formats.
If the --deep-inheritance
/--di
command option is set, all direct and
indirect subclasses are included in the result. Otherwise, only one level of
the class hierarchy is in the result.
The following example enumerates the class names of the root classes in the default namespace because there is no classname and the –DeepInheritance option is not specified:
$ pywbemcli --name mymock class enumerate --names-only
TST_Person
TST_Lineage
TST_MemberOfFamilyCollection
TST_FamilyCollection
The class enumerate
command includes result filter options that filter returned
classes to display only those classes that have the defined filter option.
Thus, pywbemcli class enumerate --association
displays only classes that
have the Association qualifier set. The filters are documented in the class
filter options table .
Filter option name |
Component filtered |
---|---|
|
Association qualifier(class) (see Note 1) |
|
Indications qualifier(class) |
|
Experimental qualifier(class) |
|
Deprecated qualifier (any class element) |
|
Version qualifier GE <CIM_Version_string> (see Note 2) |
|
Schema component of classname equality(see Note 3) |
|
Subclasses of <classname>. |
|
Classes with no subclass. |
The filters defined as
--...
/--no-...
allow testing for the existence of the condition (association qualifier exists) or the non-existence(association qualifier does not exist on the class). When neither definition of the option is defined the association qualifier is ignored in the filtering. This applies to boolean qualifier declarations.The CIM version string value in the Version qualifier is defined as 3 integers separated by periods (ex. 2.14.0). All 3 integers must exist.
The schema component is True if the schema component of classname (characters before “_” match <schema_string>). Ex –schema “CIM”
The
--leaf-classes
filter can be important because the pywbem MOF compiler can compile all dependent classes given only the leaf classes.
If multiple filter options are applied, all of the boolean options must be true for
the class to be displayed and only the classes that pass non-boolean filters
(ex. --schema CIM
) for the classes to be displayed.
Thus, for example:
the combination of
--subclass-of CIM_blah
and--leaf-classes
will return all leaf classes that are a subclass ofCIM_Blah
.--association
andno-experimental
will display only classes that have the Association qualifier set and the Experimental qualifier not set.
The following example displays classnames (--no
) that are not associations
(--no-association
). The use of --deep-inheritance
returns the complete
set of classes in the namespace rather than just direct subclasses (in this case
the root classes).
$ pywbemcli --name mymock class enumerate --no --deep-inheritance --no-association
TST_Person
TST_Lineage
See pywbemcli class enumerate –help for the exact help output of the command.
class find
command¶
The class find
command lists classes with a class name that matches the
Unix-style path name pattern specified in the CLASSNAME-GLOB
argument in all namespaces of the connection, or otherwise in the specified
namespaces if the -namespace
/-n
command option is specified one or more
times.
The class find
command includes filter options that filter returned classes
to display only those classes that have the defined filter options. Thus,
pywbemcli class enumerate --association
displays only classes that have the
Association qualifier set. The filters are documented in the class filter
options table .
The command displays the namespaces and class names of the result using the
txt
output format (default), or using Table output formats.
$ pywbemcli class find .*_WBEMS*
root/PG_InterOp:CIM_WBEMServer
root/PG_InterOp:CIM_WBEMServerCapabilities
root/PG_InterOp:CIM_WBEMServerNamespace
root/PG_InterOp:CIM_WBEMService
test/EmbeddedInstance/Dynamic:CIM_WBEMService
test/EmbeddedInstance/Static:CIM_WBEMService
test/TestProvider:CIM_WBEMServer
test/TestProvider:CIM_WBEMServerCapabilities
test/TestProvider:CIM_WBEMServerNamespace
test/TestProvider:CIM_WBEMService
root/SampleProvider:CIM_WBEMService
root/cimv2:CIM_WBEMServer
root/cimv2:CIM_WBEMServerCapabilities
root/cimv2:CIM_WBEMServerNamespace
root/cimv2:CIM_WBEMService
root/PG_Internal:PG_WBEMSLPTemplate
$ pywbemcli --output-format table class find CIM_SystemComponent*
Find class CIM_SystemComponent*
+-------------------------------+---------------------+
| Namespace | Classname |
|-------------------------------+---------------------|
| root/PG_InterOp | CIM_SystemComponent |
| test/WsmTest | CIM_SystemComponent |
| test/cimv2 | CIM_SystemComponent |
| test/CimsubTestNS0 | CIM_SystemComponent |
| test/TestProvider | CIM_SystemComponent |
| test/EmbeddedInstance/Dynamic | CIM_SystemComponent |
| root/SampleProvider | CIM_SystemComponent |
| test/CimsubTestNS1 | CIM_SystemComponent |
| test/static | CIM_SystemComponent |
| test/CimsubTestNS2 | CIM_SystemComponent |
| test/TestINdSrcNS2 | CIM_SystemComponent |
| test/EmbeddedInstance/Static | CIM_SystemComponent |
| test/CimsubTestNS3 | CIM_SystemComponent |
| test/TestIndSrcNS1 | CIM_SystemComponent |
| root/cimv2 | CIM_SystemComponent |
| root/benchmark | CIM_SystemComponent |
+-------------------------------+---------------------+
See pywbemcli class find –help for the exact help output of the command.
class get
command¶
The class get
command gets the specified class.
The class is named with the CLASSNAME
argument and is in the
namespace specified with the -namespace
/-n
command option, or otherwise
in the default namespace of the connection.
The class definition is displayed using CIM object output formats. This command does not support Table output formats.
The following example shows getting the MOF representation of the class
CIM_Foo
:
$ pywbemcli --name mymock class get CIM_Foo
[Description ( "Simple CIM Class" )]
class CIM_Foo {
[Key ( true ),
Description ( "This is key property." )]
string InstanceID;
[Description ( "This is Uint32 property." )]
uint32 IntegerProp;
[Description ( "Method with in and out parameters" )]
uint32 Fuzzy(
[IN ( true ),
OUT ( true ),
Description ( "Define data to be returned in output parameter" )]
string TestInOutParameter,
[IN ( true ),
OUT ( true ),
Description ( "Test of ref in/out parameter" )]
CIM_Foo REF TestRef,
[IN ( false ),
OUT ( true ),
Description ( "Rtns method name if exists on input" )]
string OutputParam,
[IN ( true ),
Description ( "Defines return value if provided." )]
uint32 OutputRtnValue);
[Description ( "Method with no Parameters" )]
uint32 DeleteNothing();
};
See pywbemcli class get –help for the exact help output of the command.
class invokemethod
command¶
The class invokemethod
command invokes a CIM method on the specified class
and displays the return value and any output parameters.
The class is named with the CLASSNAME
argument and is in the
namespace specified with the -namespace
/-n
command option, or otherwise
in the default namespace of the connection.
Input parameters for the method can be specified with the --parameter
/-p
command option, which can be specified multiple times.
For details, see Specifying CIM property and parameter values.
The return value and output parameters are displayed using CIM object output formats.
This command invokes a method on a class, not on an instance. To invoke a method on an instance, use the instance invokemethod command.
Example:
$ pywbemcli --mock-server tests/unit/all_types.mof --mock-server tests/unit/all_types_method_mock.py.py
pywbemcli> class invokemethod PyWBEM_AllTypes AllTypesMethod --parameter arrBool=True,False
ReturnValue=0
arrBool=true, false
See pywbemcli class invokemethod –help for the exact help output of the command.
class references
command¶
The class references
command lists the CIM classes that reference
the specified source class.
The source class is named with the CLASSNAME
argument and is in the
namespace specified with the -namespace
/-n
command option, or otherwise
in the default namespace of the connection.
If the --names-only
/--no
command option is set, only the class path is
displayed, using CIM object output formats or
Table output formats. Otherwise, the class definition is displayed,
using CIM object output formats.
Note: This command returns the class references, not the instance references. The instance references command returns the instance references.
$ pywbemcli --name mymock class references TST_Person --names-only
//FakedUrl/root/cimv2:TST_Lineage
//FakedUrl/root/cimv2:TST_MemberOfFamilyCollection
See pywbemcli class references –help for the exact help output of the command.
class tree
command¶
The class tree
command displays the subclass or superclass hierarchy of the
specified class.
The class is named with the CLASSNAME
argument and is in the
namespace specified with the -namespace
/-n
command option, or otherwise
in the default namespace of the connection.
If CLASSNAME
is omitted, the complete class hierarchy of the namespace is
displayed.
If the -superclasses
command option is set, the specified class and its
superclass ancestry up to the top-level class are displayed. Otherwise,
the specified class and its subclass hierarchy are displayed.
The class hierarchy (or ancestry) is always formatted in the
Tree output format; the --output-format
/-o
general option is
ignored.
Example:
$ pywbemcli class tree CIM_Foo
CIM_Foo
+-- CIM_Foo_sub
| +-- CIM_Foo_sub_sub
+-- CIM_Foo_sub2
Options to the class tree command allow the following:
Display the superclass hierarchy for a given class (
--superclasses
/-s
) as shown in the following example:
Example:
$ pywbemcli -n mock1 class tree CIM_Foo_Sub2 -s
root
+-- CIM_Foo
+-- CIM_Foo_sub2
Display additional information about each class (
--detail
/-d
) including the value of the Version qualifier and the existence of the class the Association, Indication, Abstract qualifiers if they are True as shown in the following example:
Example:
$ pywbemcli -m tests/unit/tree_test_model.mof class tree --detail
root
+-- CIM_Foo (Version=2.30.0)
| +-- CIM_Foo_sub (Version=2.31.0)
| +-- CIM_Foo_sub_sub (Version=2.20.1)
+-- CIM_Foo_no_version ()
+-- CIM_Indication (Abstract,Indication,Version=2.24.0)
+-- CIM_Indication_no_version (Abstract,Indication)
+-- TST_Lineage (Association,Version=2.20.1)
+-- TST_Lineage_no_version (Association)
See pywbemcli class tree –help for the exact help output of the command.
instance
command group¶
The instance
command group has commands that act on CIM instances:
instance associators command - List the instances associated with an instance.
instance count command - Count the instances of each class with matching class name.
instance create command - Create an instance of a class in a namespace.
instance delete command - Delete an instance of a class.
instance enumerate command - List the instances of a class.
instance get command - Get an instance of a class.
instance invokemethod command - Invoke a method on an instance.
instance modify command - Modify properties of an instance.
instance references command - Execute a query on instances in a namespace.
instance query command - List the instances referencing an instance.
instance shrub command - Display association instance relationships.
instance associators
command¶
The instance associators
command lists the CIM instances that are associated
with the specified source instance.
The specification of the instance name (INSTANCENAME argument) is documented in the section Specifying the INSTANCENAME command argument.
If the --names-only
/--no
command option is set, only the instance paths
are displayed. Otherwise, the instances are displayed.
Valid output formats in both cases are CIM object output formats or Table output formats.
Note: This command returns the instance associators, not the class associators. The class associators command returns the class associators.
Example:
$ pywbemcli --name mymock instance references TST_Person.? --names-only
Pick Instance name to process: 0
0: root/cimv2:TST_Person.name="Mike"
1: root/cimv2:TST_Person.name="Saara"
2: root/cimv2:TST_Person.name="Sofi"
3: root/cimv2:TST_Person.name="Gabi"
4: root/cimv2:TST_PersonSub.name="Mikesub"
5: root/cimv2:TST_PersonSub.name="Saarasub"
6: root/cimv2:TST_PersonSub.name="Sofisub"
7: root/cimv2:TST_PersonSub.name="Gabisub"
Input integer between 0 and 7 or Ctrl-C to exit selection: 0 << entered by user
//FakedUrl/root/cimv2:TST_Lineage.InstanceID="MikeSofi"
//FakedUrl/root/cimv2:TST_Lineage.InstanceID="MikeGabi"
//FakedUrl/root/cimv2:TST_MemberOfFamilyCollection.family="root/cimv2:TST_FamilyCollection.name=\"Family2\"",member="root/cimv2:TST_Person.name=\"Mike\""
See pywbemcli instance associators –help for the exact help output of the command.
instance count
command¶
The instance count
command counts the CIM instances of some or all classes
in the namespaces specified with the -namespace
/-n
command option, or
all namespaces in the server.
This command displays the count of instances of each CIM class whose class name matches the specified wildcard expression (CLASSNAME-GLOB) in all CIM namespaces of the WBEM server, or in the specified namespaces (–namespace option). This differs from instance enumerate, etc. in that it counts the instances specifically for the classname of each instance returned (the creation classname), not including subclasses.
If the CLASSNAME-GLOB
argument is specified, only instances of classes that
match the specified Unix-style path name pattern are counted. If the
CLASSNAME-GLOB
argument is not specified all instances of all classes in
the target namespaces are counted.
The --association
/--no-association
,
--indication
/--no-indication
, ,``–experimental``/--no-experimental
and --deprecated
/--no-deprecated
options filter the returned classes or
classnames to include or exclude classes with the corresponding qualifiers.
Thus the --association
option returns only classes or classnames that are
association classes.
Results for classes that have no instances are not displayed.
This command can take a long time to execute since it potentially enumerates all instance names for all classes in all namespaces.
Valid output formats are Table output formats.
Example:
$ pywbemcli --name mymock instance count
Count of instances per class
+-------------+------------------------------+---------+
| Namespace | Class | count |
|-------------+------------------------------+---------|
| root/cimv2 | TST_FamilyCollection | 2 |
| root/cimv2 | TST_Lineage | 3 |
| root/cimv2 | TST_MemberOfFamilyCollection | 3 |
| root/cimv2 | TST_Person | 4 |
| root/cimv2 | TST_Personsub | 4 |
+-------------+------------------------------+---------+
Count is useful to determine which classes in the environment are actually implemented. However this command can take a long time to execute because it must a) enumerate all classes in the namespace, b) enumerate the instances for each class.
See pywbemcli instance count –help for the exact help output of the command.
instance create
command¶
The instance create
command creates a CIM instance in the namespace
specified with the -namespace
/-n
command option, or otherwise in the
default namespace of the connection.
The new CIM instance has the creation class specified in the CLASSNAME
argument and initial property values as specified by zero or more
--property
/-p
command options.
For details, see Specifying CIM property and parameter values.
The command displays the instance path of the new instance that is returned by
the WBEM server, using txt
output format.
Since the WBEM server (and pywbem) requires that each property be typed, pywbemcli retrieves the creation class from the WBEM server to determine the data types for the properties.
The following examples create an instance of the class TST_Blah with two scalar and one array property:
$ pywbemcli instance create TST_Blah --property InstancId=blah1 --property IntProp=3 --property IntArr=3,6,9
$ pywbemcli instance create TST_Blah --property InstancId=\"blah 2\" --property IntProp=3 --property IntArr=3,6,9
See pywbemcli instance create –help for the exact help output of the command.
instance delete
command¶
The instance delete
command deletes a CIM instance.
The specification of the instance name (INSTANCENAME argument) is documented in the section Specifying the INSTANCENAME command argument.
The following example deletes an instance by specifying its instance name. Note the extra backslash (see backslash-escaped) that is required to escape the double quote on the terminal:
$ pywbemcli --name mymock instance delete root/cimv2:TST_Person.name=\"Saara\"
See pywbemcli instance delete –help for the exact help output of the command.
instance enumerate
command¶
The instance enumerate
command lists the CIM instances of the specified
class (including subclasses) in a namespace.
The class is named with the CLASSNAME
argument and is in the
namespace specified with the -namespace
/-n
command option, or otherwise
in the default namespace of the connection.
If the --names-only
/--no
command option is set, only the instance paths
are displayed. Otherwise, the instances are displayed.
The --propertylist
/--pl
command option allows restricting the set of
properties to be retrieved and displayed on the instances.
Valid output formats in both cases are CIM object output formats or Table output formats.
The following example returns two instances as MOF:
$ pywbemcli --name mymock instance enumerate TST_FamilyCollection
instance of TST_FamilyCollection {
name = "family1";
};
instance of TST_FamilyCollection {
name = "Family2";
};
See pywbemcli instance enumerate –help for the exact help output of the command.
instance get
command¶
The instance get
command gets a CIM instance.
The specification of the instance name (INSTANCENAME argument) is documented in the section Specifying the INSTANCENAME command argument.
The --propertylist
/--pl
command option allows restricting the set of
properties to be retrieved and displayed on the instance.
The command displays the instance using CIM object output formats or Table output formats.
This example gets an instance by instance name:
$ pywbemcli --name mymock instance get root/cimv2:TST_Person.name=\"Saara\"
instance of TST_Person {
name = "Saara";
};
or using the keys wildcard:
$ pywbemcli --name mymock instance get root/cimv2:TST_Person.?
Pick Instance name to process
0: root/cimv2:CIM_Foo.InstanceID="CIM_Foo1"
1: root/cimv2:CIM_Foo.InstanceID="CIM_Foo2"
2: root/cimv2:CIM_Foo.InstanceID="CIM_Foo3"
Input integer between 0 and 2 or Ctrl-C to exit selection: 0 << entered by user
instance of TST_Person {
name = "Saara";
};
See pywbemcli instance get –help for the exact help output of the command.
instance invokemethod
command¶
The instance invokemethod
command invokes a CIM method on the specified
instance and displays the return value and any output parameters.
The specification of the instance name (INSTANCENAME argument) is documented in the section Specifying the INSTANCENAME command argument.
Input parameters for the method can be specified with the --parameter
/-p
command option, which can be specified multiple times.
For details, see Specifying CIM property and parameter values.
The return value and output parameters are displayed using CIM object output formats.
Example:
$ pywbemcli --mock-server tests/unit/all_types.mof --mock-server tests/unit/all_types_method_mock.py.py
pywbemcli> instance invokemethod PyWBEM_AllTypes.InstanceId=\"test_instance\" AllTypesMethod --parameter arrBool=True,False
ReturnValue=0
arrBool=true, false
Or using the wildcard to create a selection list for the instance names
$ pywbemcli --mock-server tests/unit/all_types.mof --mock-server tests/unit/all_types_method_mock.py.py
pywbemcli> instance invokemethod PyWBEM_AllTypes.? --parameter arrBool=True,False
Pick Instance name to process
0: root/cimv2:CIM_Foo.InstanceID="CIM_Foo1"
1: root/cimv2:CIM_Foo.InstanceID="CIM_Foo2"
2: root/cimv2:CIM_Foo.InstanceID="CIM_Foo3"
Input integer between 0 and 2 or Ctrl-C to exit selection: 0 << entered by user
ReturnValue=0
arrBool=true, false
See pywbemcli instance invokemethod –help for the exact help output of the command.
instance modify
command¶
The instance modify
command modifies the properties of an existing CIM
instance.
The specification of the instance name (INSTANCENAME argument) is documented in the section Specifying the INSTANCENAME command argument.
The new property values are specified by possibly multiple --property
/-p
command options.
For details, see Specifying CIM property and parameter values.
Note that key properties cannot be modified, as per DSP0004.
The --propertylist
/--pl
command option allows restricting the set of
properties to be modified. It is supported for consistency with the
corresponding parameter at the CIM-XML protocol level, but given that the set
of properties to be modified is already determined by the specified
--property
/-p
command options, the --propertylist
/--pl
command
option does not need to be specified.
Since the WBEM server (and pywbem) requires that each property be typed, pywbemcli retrieves the creation class from the WBEM server to determine the data types for the properties.
The following examples modifies an instance of the class TST_Blah with two scalar and one array property:
$ pywbemcli instance modify TST_Blah --property InstancId=blah1 --property IntProp=3 --property IntArr=3,6,9
$ pywbemcli instance modify TST_Blah --property InstancId=\"blah 2\" --property IntProp=3 --property IntArr=3,6,9
See pywbemcli instance modify –help for the exact help output of the command.
instance references
command¶
The instance references
command lists the CIM instances that reference
the specified source instance.
The specification of the instance name (INSTANCENAME argument) is documented in the section Specifying the INSTANCENAME command argument.
If the --names-only
/--no
command option is set, only the instance paths
are displayed. Otherwise, the instances are displayed.
Valid output formats in both cases are CIM object output formats or Table output formats.
Note: This command returns the instance references, not the class references. The class references command returns the class references.
Example:
$ pywbemcli --name mymock instance references root/cimv2:TST_Person.name=\"Saara\"
instance of TST_Lineage {
InstanceID = "SaaraSofi";
parent = "/root/cimv2:TST_Person.name=\"Saara\"";
child = "/root/cimv2:TST_Person.name=\"Sofi\"";
};
See pywbemcli instance references –help for the exact help output of the command.
instance query
command¶
The instance query
command executes a query for CIM instances in a
namespace.
The query is specified with the QUERY
argument and must be a valid query
in the query language specified with the --query-language
/--ql
command
option. The default for that option is DMTF:CQL
(see CQL).
The namespace is specified with the --namespace
/-n
command option, or
otherwise is the default namespace of the connection.
Valid output formats are CIM object output formats or Table output formats.
See pywbemcli instance query –help for the exact help output of the command.
instance shrub
command¶
The instance shrub
command executes a set of requests to get the
association relationships for a non-association CIM instance defined by
INSTANCENAME in a namespace and displays the result either as tree in ascii
or as a table showing the roles, reference classes, associated
classes and associated instances for the input instance.
A shrub is a structure that attempts to show all of the relationships and the paths between the input INSTANCENAME and the associated instances whereas the References command only shows referencing(associator) classes or instances and the Associators command only shows associated classes or instances.
The namespace for the INSTANCENAME is specified with the -namespace
/-n
command option, or otherwise is the default namespace of the connection.
Valid output formats are Table output formats or the default which displays the a visual tree.
The instance shrub
command includes command options to:
--summary
/-s
: Show only the class components and a count of instances.--fullpath
/-f
: Show the full path of the instances. The default is to attempt to shorten the path by removing path components that are the same for all instances displayed. This can be important for some of the components of the model where instance paths include keys likeCreationClassName
and ‘SystemCreationClassName’which are either already known or do not distinguish instances but make the instance name difficult to visualize on the console. These key bindings are replaced with the character~
as a placemarker unless the--fullpath
/-f
option is defined.
Thus, a full path might look like:
/:CIM_FCPort.SystemCreationClassName="CIM_ComputerSystem",SystemName="ACME+CF2A5091300089",CreationClassName="CIM_FCPort",DeviceID="ACME+CF2A5091300089+SP_A+10"
But the shortened path would be:
/:CIM_FCPort.~,~,~,DeviceID="ACME+CF2A5091300089+SP_A+10"
This command is primarily a diagnostic and test tool to help users understand what comprises CIM association relationships.
See pywbemcli instance shrub –help for the exact help output of the command.
Example:
$ pywbemcli instance shrub root/cimv2:TST_EP.InstanceID=1
TST_EP.InstanceID=1
+-- Initiator(Role)
+-- TST_A3(AssocClass)
+-- Target(ResultRole)
| +-- TST_EP(ResultClass)(3 insts)
| +-- TST_EP.InstanceID=2(refinst:0)
| +-- TST_EP.InstanceID=5(refinst:1)
| +-- TST_EP.InstanceID=7(refinst:2)
+-- LogicalUnit(ResultRole)
+-- TST_LD(ResultClass)(3 insts)
+-- TST_LD.InstanceID=3(refinst:0)
+-- TST_LD.InstanceID=6(refinst:1)
+-- TST_LD.InstanceID=8(refinst:2)
This displays the Role (Initiator), AssociationClass (TST_A3), etc for the
instance name defined in the command which is a complex association that
contains 3 reference properties. The tag refinst
on each instance
defines the corresponding reference instance so that the instances
returned can be correlated back to their reference instances.
The resulting table output for the same command but with -o table
is:
Example:
$ pywbemcli -o table instance shrub root/cimv2:TST_EP.InstanceID=1
Shrub of root/cimv2:TST_EP.InstanceID=1
+-----------+-------------------+--------------+--------------------+-------------------------+
| Role | Reference Class | ResultRole | Associated Class | Assoc Inst paths |
|-----------+-------------------+--------------+--------------------+-------------------------|
| Initiator | TST_A3 | Target | TST_EP | /:TST_EP. |
| | | | | InstanceID=2(refinst:0) |
| | | | | /:TST_EP. |
| | | | | InstanceID=5(refinst:1) |
| | | | | /:TST_EP. |
| | | | | InstanceID=7(refinst:2) |
| Initiator | TST_A3 | LogicalUnit | TST_LD | /:TST_LD. |
| | | | | InstanceID=3(refinst:0) |
| | | | | /:TST_LD. |
| | | | | InstanceID=6(refinst:1) |
| | | | | /:TST_LD. |
| | | | | InstanceID=8(refinst:2) |
+-----------+-------------------+--------------+--------------------+-------------------------+
qualifier
command group¶
The qualifier
command group has commands that act on CIM qualifier
declarations:
qualifier get command - Get a qualifier declaration.
qualifier delete command - Delete a qualifier declaration.
qualifier enumerate command - List the qualifier declarations in a namespace.
qualifier get
command¶
The qualifier get
command gets the specified qualifier declaration.
The qualifier declaration is named with the QUALIFIERNAME
argument and is
in the namespace specified with the -namespace
/-n
command option, or
otherwise in the default namespace of the connection.
The qualifier declaration is displayed using CIM object output formats or Table output formats.
The following example gets the Key
qualifier declaration from the
default namespace:
$ pywbemcli --name mymock qualifier get Key
Qualifier Key : boolean = false,
Scope(property, reference),
Flavor(DisableOverride, ToSubclass);
See pywbemcli qualifier get –help for the exact help output of the command.
qualifier delete
command¶
The qualifier delete
command deletes the specified qualifier declaration.
The qualifier declaration is named with the QUALIFIERNAME
argument and is
in the namespace specified with the -namespace
/-n
command option, or
otherwise in the default namespace of the connection.
The qualifier declaration is deleted using the DeleteQualifier operation. It is left to the WBEM server to reject the deletion if the qualifier is used anywhere.
The following example deletes the Xyz
qualifier declaration from the
default namespace:
$ pywbemcli --name mymock qualifier delete Xyz
Deleted qualifier Xyz
See pywbemcli qualifier delete –help for the exact help output of the command.
qualifier enumerate
command¶
The qualifier enumerate
command enumerates the qualifier declarations in
a namespace.
The namespace is specified with the -namespace
/-n
command option, or
otherwise is the default namespace of the connection.
The qualifier declaration is displayed using CIM object output formats or Table output formats.
This example displays all of the qualifier declarations in the default namespace as a table:
$ pywbemcli --name mymock --output-format table qualifier enumerate
Qualifier Declarations
+-------------+---------+---------+---------+-------------+-----------------+
| Name | Type | Value | Array | Scopes | Flavors |
|-------------+---------+---------+---------+-------------+-----------------|
| Association | boolean | False | False | ASSOCIATION | DisableOverride |
| | | | | | ToSubclass |
| Description | string | | False | ANY | EnableOverride |
| | | | | | ToSubclass |
| | | | | | Translatable |
| In | boolean | True | False | PARAMETER | DisableOverride |
| | | | | | ToSubclass |
| Key | boolean | False | False | PROPERTY | DisableOverride |
| | | | | REFERENCE | ToSubclass |
| Out | boolean | False | False | PARAMETER | DisableOverride |
| | | | | | ToSubclass |
+-------------+---------+---------+---------+-------------+-----------------+
See pywbemcli qualifier enumerate –help for the exact help output of the command.
profile
command group¶
Profile list command - List management profiles advertised by the server.
profile centralinsts command - List central instances of management profiles on the server.
Profile list
command¶
The profile list
command lists the
management profiles advertised by the
WBEM server of the current connection.
The returned management profiles are displayed with organization, profile name, and profile version using the Table output formats.
The --organization
/-o
and --profile
/ -p
command options can be
used to filter the returned management profiles by organization and profile
name, respectively.
Example:
$ pywbemcli --name myserver --output-format simple profile list
Advertised management profiles:
Organization Registered Name Version
-------------- ------------------------ ---------
DMTF CPU 1.0.0
DMTF Computer System 1.0.0
DMTF Ethernet Port 1.0.0
DMTF Fan 1.0.0
DMTF Indications 1.1.0
DMTF Profile Registration 1.0.0
Other Some Other Subprofile 0.1.0
Other Some Subprofile 0.1.0
Other SomeSystemProfile 0.1.0
SNIA Array 1.1.0
SNIA Block Server Performance 1.1.0
SNIA Disk Drive Lite 1.1.0
SNIA Indication 1.1.0
SNIA Indication 1.2.0
SNIA Profile Registration 1.0.0
SNIA SMI-S 1.2.0
SNIA Server 1.1.0
SNIA Server 1.2.0
SNIA Software 1.1.0
SNIA Software 1.2.0
See pywbemcli profile list –help for the exact help output of the command.
profile centralinsts
command¶
The profile centralinsts
command gets the central instances
of the management profiles advertised by the
WBEM server of the current connection.
The command displays the instance paths of the central instances by profile, using the Table output formats.
The --organization
/-o
and --profile
/ -p
command options can be
used to filter the result by organization and name of the management profiles,
respectively.
Example:
$ pywbemcli profile centralinsts --organization DMTF --profile "Computer System"
Advertised Central Instances:
+---------------------------------+----------------------------------------------------------------------------------------------------------------------+
| Profile | Central Instances |
|---------------------------------+----------------------------------------------------------------------------------------------------------------------|
| DMTF:Computer System:1.0.0 | //leonard/test/TestProvider:Test_StorageSystem.Name="StorageSystemInstance1",CreationClassName="Test_StorageSystem" |
| | //leonard/test/TestProvider:Test_StorageSystem.Name="StorageSystemInstance2",CreationClassName="Test_StorageSystem" |
+---------------------------------+----------------------------------------------------------------------------------------------------------------------+
See pywbemcli profile centralinsts –help for the exact help output of the command.
server
command group¶
The server
command group has commands that interact with the WBEM
server of the current connection to access information about the
WBEM server itself:
server brand command - Get the brand of the server.
server info command - Get information about the server.
server interop command - Get the Interop namespace of the server.
server namespaces command - List the namespaces of the server.
server brand
command¶
The server brand
command gets the brand of the WBEM server of the
current connection.
The brand is intended to identify the product that represents the WBEM server infrastructure. Since that was not clearly defined in the DMTF specifications, this command may return strange results for some servers, but it returns legitimate results for the most commonly used servers.
The brand is displayed using Table output formats.
Example:
$ pywbemcli --name myserver server brand
Server Brand:
+---------------------+
| WBEM server brand |
|---------------------|
| OpenPegasus |
+---------------------+
See pywbemcli server brand –help for the exact help output of the command.
server info
command¶
The server info
command gets general information on the WBEM server of the
current connection.
This includes the brand, version, namespaces, and other reasonable information on the WBEM server.
The result is displayed using Table output formats.
Example:
$ pywbemcli --name myserver server info
Server General Information
+-------------+-----------+---------------------+-------------------------------+
| Brand | Version | Interop Namespace | Namespaces |
|-------------+-----------+---------------------+-------------------------------|
| OpenPegasus | 2.15.0 | root/PG_InterOp | root/PG_InterOp |
| | | | root/benchmark |
| | | | root/SampleProvider |
| | | | test/CimsubTestNS2 |
| | | | test/CimsubTestNS3 |
| | | | test/CimsubTestNS0 |
| | | | test/CimsubTestNS1 |
| | | | root/PG_Internal |
| | | | test/WsmTest |
| | | | test/TestIndSrcNS1 |
| | | | test/TestINdSrcNS2 |
| | | | test/EmbeddedInstance/Static |
| | | | test/TestProvider |
| | | | test/EmbeddedInstance/Dynamic |
| | | | root/cimv2 |
| | | | root |
| | | | test/cimv2 |
| | | | test/static |
+-------------+-----------+---------------------+-------------------------------+
See pywbemcli server info –help for the exact help output of the command.
server interop
command¶
The server interop
command gets the name of the Interop namespace of the
WBEM server of the current connection.
The result is displayed using Table output formats.
Example:
$ pywbemcli --name myserver server interop
Server Interop Namespace:
+------------------+
| Namespace Name |
|------------------|
| root/PG_InterOp |
+------------------+
See pywbemcli server interop –help for the exact help output of the command.
server namespaces
command¶
The server namespaces
command lists the namespaces of the WBEM server of
the current connection.
The result is displayed using txt
output format or
Table output formats.
The Interop namespace must exist on the server.
Example:
$ pywbemcli --name myserver --output-format plain server namespaces
Namespace Name
root/PG_InterOp
root/benchmark
root/PG_Internal
test/WsmTest
test/EmbeddedInstance/Static
test/TestProvider
test/EmbeddedInstance/Dynamic
root/cimv2
root
test/cimv2
test/static
See pywbemcli server namespaces –help for the exact help output of the command.
server add-mof
command¶
The server add-mof
command compiles one or more MOF files and adds the
resulting CIM objects to the target namespace in the WBEM server of the
current connection.
Example:
$ pywbemcli --name myserver server add-mof mymodel.mof
See pywbemcli server add-mof –help for the exact help output of the command.
server remove-mof
command¶
The server remove-mof
command compiles one or more MOF files and adds the
resulting CIM objects to the target namespace in the WBEM server of the
current connection.
Example:
$ pywbemcli --name myserver server remove-mof mymodel.mof
See pywbemcli server remove-mof –help for the exact help output of the command.
statistics
command group¶
The statistics
command group includes commands that display statistics
about the WBEM operations executed by a real WBEM server (or by a mock
environment).
Statistics on WBEM operations are maintained by the pywbemcli client, and also separately by WBEM servers that support this. There are multiple components to statistics gathering and reporting in pywbemcli:
Pywbemcli gathers and maintains statistics on WBEM operations it executes against a WBEM server (or mock environment). The client maintained statistics can be displayed either automatically after each pywbemcli command if the
--timestats
/-T
general option is used, or in interactive mode with thestatistics show
command.For mock environments, artificial operations on the MOF compile time needed for setting up the mock respository are included in the client maintained statistics.
WBEM servers may support two capabilities for managing statistics on WBEM operations:
Each CIM-XML response from the WBEM server may include an extra header field
WBEMServerResponseTime
with the server response time for that operation. Pywbemcli puts those server response times into the client statistics it maintains. The inclusion of the server response time into the CIM-XML response can be enabled and disabled with thestatistics server-on
andstatistics server-off
commands.Statistical information on operation execution in the WBEM server and its providers may be gathered and maintained and by the WBEM server. These server maintained statistics are completely independent of the client maintained statistics and will include the operations driven by all clients working with that server. The gathering of server statistics can be enabled and disabled with the
statistics server-on
andstatistics server-off
commands. The server maintained statistics can be retrieved and displayed with thestatistics server-show
command.
The mock environment implemented by pywbemcli does not support server maintained statistics.
The capabilities for managing and retrieving server maintained statistics is supported only in some WBEM server implementations. While these capabilities were documented in the DMTF CIM Schema, they were never included as part of a DMTF or SNIA management profile, so the implementations may vary across WBEM server implementations. Pywbemcli makes a best effort to interact with the server maintained statistics based on the documentation in the DMTF CIM Schema, and has been verified to work with OpenPegasus.
The statistics commands are:
statistics reset command - Reset client maintained statistics.
statistics server-on command - Enable server maintained statistics.
statistics server-off command - Disable server maintained statistics.
statistics server-show command - Display server maintained statistics.
statistics show command - Display client maintained statistics (interactive mode).
statistics status command - Show enabled status of client and server maintained statistics.
statistics server-on
command¶
The statistics server-on
command attempts to enable statistics gathering
on the current WBEM server and the returning of the server response time in the
‘WBEMServerResponseTime’ header field of the CIM-XML response, by setting the
‘GatherStatisticalData’ property to True in the ‘CIM_ObjectManager’ instance
for the WBEM server.
See ‘_Operation statistics’_ for more information on statistics in pywbemcli and WBEM servers.
Since only some WBEM server implementations actually implement statistics gathering, the command may fail, for example if the ‘CIM_ObjectManager’ class or its property ‘GatherStatisticalData’ have not been implemented by the server, or if the server does not allow a client to modify the property.
Note that this command also affects whether the “Server Time” column of the client maintained statistics shows a value.
statistics server-off
command¶
The statistics server-off
command attempts to disable statistics gathering
on the current WBEM server and the returning of the server response time in the
‘WBEMServerResponseTime’ header field of the CIM-XML response, by setting the
‘GatherStatisticalData’ property to False in the ‘CIM_ObjectManager’ instance
for the WBEM server.
See ‘_Operation statistics’_ for more information on statistics in pywbemcli and WBEM servers.
Since only some WBEM server implementations actually implement statistics gathering, the command may fail, for example if the ‘CIM_ObjectManager’ class or its property ‘GatherStatisticalData’ have not been implemented by the server, or if the server does not allow a client to modify the property.
Note that this command also affects whether the “Server Time” column of the client maintained statistics shows a value.
statistics status
command¶
The statistics status
command displays the enabled status of the
statistic gathering in the current WBEM server and of the automatic display
of the client maintained statistics.
See ‘_Operation statistics’_ for more information on statistics in pywbemcli and WBEM servers.
statistics reset
command¶
The statistics reset
command resets the counters of the client maintained
statistics. This includes the server response times returned by the WBEM server
that are part of the client maintained statistics.
statistics show
command¶
The statistics show
command displays the client maintained statistics.
Using this command only makes sense in interactive mode. In interactive mode, the statistics is maintained for the entire interactive session, and executing commands that communicate with the server in the interactive session causes the statistics counters to be updated.
The following example shows the use of the statistics show
command in
the interactive mode with a real WBEM server:
$ pywbemcli -n pegasus
pywbemcli> server brand
OpenPegasus
pywbemcli> statistics show
Client statistics
Operation Count Errors Client Time Server Time Request Size Response Size
[ms] [ms] [B] [B]
---------------------- ------- -------- ------------- ------------- -------------- ---------------
EnumerateInstanceNames 2 1 33.174 1.407 333 6225
EnumerateInstances 1 0 7.938 2.813 345 3504
The following example shows the use of the statistics show
command in
the interactive mode with a mock environment:
$ pywbemcli -n mock1
pywbemcli> class enumerate --di --no
CIM_Foo
CIM_Foo_sub
CIM_Foo_sub2
CIM_Foo_sub_sub
pywbemcli> statistics show
Client statistics
Operation Count Errors Client Time Server Time Request Size Response Size
[ms] [ms] [B] [B]
------------------------- ------- -------- ------------- ------------- -------------- ---------------
compile_mof_file(ns=None) 1 0 149.862 0 0 0
CreateClass 4 0 4.075 0 0 0
CreateInstance 12 0 1.715 0 0 0
EnumerateClassNames 1 0 0.167 0 0 0
SetQualifier 10 0 0.139 0 0 0
The Operation column shows the name of the WBEM operation, plus the following additional entries:
compile_mof_file(ns=None)
The Count column shows the number of operations executed.
The Errors column shows the number of cases where the operation has resulted in an error at the level of the CIM-XML protocol. The occurrence of such errors is not necessarily a problem, depending on the logic in the pywbemcli client program.
All time and size values in this report are average values across the number of operations executed, rounded to the precision shown.
The Client Time column shows the total elapsed time the operation took from a perspective of the pywbemcli client program. This time includes network time and server time and most of the time spent in the pywbemcli command. More specifically, the client time is measured by the statistics support of the pywbem library directly after the API for executing an operation, so it does include the creation of the CIM-XML for the request and the parsing of the CIM-XML for the response, but it does not include any processing in the code of the pywbemcli command above the pywbem API.
The Server Time column shows the total elapsed time the operation took from
a perspective of the WBEM server. It has the same meaning as the Server Time
value shown in the server statistics. This time includes time spent in the
CIM object manager code and time spent in its providers. The Server Time is
obtained from the header field WBEMServerResponseTime
in the CIM-XML
response message; if the WBEM server does not support returning this field or
has it disabled, the Server Time is shown as 0. That is why the Server Time
values for the mock environment example are shown as 0.
The Request Size and Response Size columns show the size of the HTTP bodies of the CIM-XML request and response messages, respectively. These values do not include the size of the HTTP header fields.
statistics server-show
command¶
The statistics server-show
command displays the server maintained statistics
of the current WBEM server. What is returned depends on the implementation of
statistics gathering in the WBEM server.
This command does that by retrieving “CIM_CIMOMStatisticalData” instances associated from the “CIM_ObjectManager” instance representing the WBEM server, and organizing them into a server statistics report.
The format of the server statistics report of a real WBEM server is shown in the example below:
$ pywbemcli -s http://localhost statistics server-show
Server statistics
Operation Count Server Time Provider Time Request Size Response Size
[ms] [ms] [B] [B]
---------------------- ------- ------------- --------------- -------------- ---------------
GetClass 315 0.239 0 399 4124
GetInstance 4 0.495 0.07 862 3128
ModifyInstance 4 0.795 0.024 3523 376
EnumerateInstances 172 1.459 0.341 383 10111
EnumerateInstanceNames 132 0.913 0.657 377 4102
OpenEnumerateInstances 156 1.986 0 616 14506
The Operation column shows the name of the WBEM operation.
The Count column shows the number of operations executed.
All time and size values in this report are average values across the number of operations executed, rounded to the precision shown.
The Server Time column shows the total elapsed time the operation took from a perspective of the WBEM server. It has the same meaning as the Server Time value shown in the client statistics. This time includes time spent in the CIM object manager code and time spent in any providers.
The Provider Time column shows the total elapsed time the operation spent in the provider from a perspective of the CIM object manager portion of the WBEM server that calls the provider. OpenPegasus only reports values for instance providers and reports the values for class and qualifier operations as 0. Other WBEM servers would typically also do that. The provider time includes the time spent for performing any actions in the managed system and also the time spent in any “up-calls” from the provider back to the CIM object manager portion of the WBEM server (and possibly down to other providers).
The Request Size and Response Size columns show the size of the CIM-XML request and response messages, respectively. For OpenPegasus and WBEM servers that followed the description in CIM_CIMOMStatisticalData.mof, these values include the size of the HTTP bodies and the size of the HTTP header fields.
Note that statistics gathering in WBEM servers is not standardized in WBEM management profiles, so the statements above are based on typical implementations of WBEM servers such as the implementation of OpenPegasus.
connection
command group¶
The connection
command group has commands that manage named connection
definitions that are persisted in a connections file.
This allows maintaining multiple connection definitions and then using any
one via the --name general option. Only a single connection is
active (selected) at any point in time but the connection connection can
be selected on the pywbemcli command line (--name general option) or
changed within an interactive session using the connection select command
The attributes of each connection definition in the connections file are:
name - name of the connection definition. See --name general option.
server - URL of the WBEM server, or None if the connection definition is for a mock WBEM server. See --server general option.
default-namespace - default namespace for the WBEM server. See --default-namespace general option.
user - user name for the WBEM server. See --user general option.
password - password for the WBEM server. See --password general option.
use-pull - determines whether the pull operations are to be used for the WBEM server. See --use-pull general option.
verify - a boolean flag controlling whether the pywbem client verifies any certificate received from the WBEM server. See --verify general option.
certfile - path name of the server certificate file. See --certfile general option.
keyfile - path name of the client private key file. See --keyfile general option.
timeout - client-side timeout for operations against the WBEM server. See --timeout general option.
mock-server - list of files defining the setup of the mock WBEM server, or None if the connection definition is for a real WBEM server. See --mock-server general option.
The commands in this group are:
connection delete command - Delete a WBEM connection definition.
connection export command - Export the current connection.
connection list command - List the WBEM connection definitions.
connection save command - Save the current connection to a new WBEM connection definition.
connection select command - Select a WBEM connection definition as current or default.
connection show command - Show connection info of a WBEM connection definition.
connection test command - Test the current connection with a predefined WBEM request.
connection delete
command¶
The connection delete
command deletes a connection definition from the
connections file.
If the NAME
argument is specified, the connection definition with that name
is deleted. Otherwise, the command displays the list of connection definitions
and prompts the user to select the one to be deleted. If there is only a
single connection, that connection is deleted without the user selection
request.
Example that deletes a connection definition by the specified name:
$ pywbemcli connection delete me
Example that deletes a connection definition by selecting it:
$ pywbemcli connection delete
Select a connection or Ctrl_C to abort.
0: mock1
1: mockassoc
2: op
Input integer between 0 and 2 or Ctrl-C to exit selection: 1 << entered by user
Deleted connection "mockassoc".
See pywbemcli connection delete –help for the exact help output of the command.
connection export
command¶
The connection export
command exports the current connection as a set of
environment variables.
This is done by displaying the commands to set the environment variables.
$ pywbemcli --server http://localhost connection export
export PYWBEMCLI_SERVER=http://localhost
export PYWBEMCLI_DEFAULT_NAMESPACE=root/cimv2
export PYWBEMCLI_TIMEOUT=30
. . .
This can be used for example on Linux and OS-X to set the environment variables as follows:
$ eval $(pywbemcli --server http://localhost connection export)
$ env |grep PYWBEMCLI
PYWBEMCLI_SERVER=http://localhost
PYWBEMCLI_DEFAULT_NAMESPACE=root/cimv2
PYWBEMCLI_TIMEOUT=30
. . .
See pywbemcli connection export –help for the exact help output of the command.
connection list
command¶
The connection list
command lists the connection definitions in the
connections file and the current connection(if it has not been
saved to the connections file).
Valid output formats are Table output formats.
This shows which connection is the current connection and if any connection is set as the default connection (connection select command ).
The current connection is marked with * in the Name column. The default connection, if defined, is marked with # in the Name column.
The title also displays the path of the file that is being used as the current connections file.
pywbemcli> --server http://localhost --user me --password mypw --no-verify connection save me
pywbemcli> --server http://blahblah connection list
WBEM server connections(brief): (#: default, *: current)
file: /home/johndoe/.pywbemcli_connections.yaml
+--------------+------------------+----------------------------------------+
| name | server | mock-server |
|--------------+------------------+----------------------------------------|
| *blahblah | http://blah | |
| mock1 | | tests/unit/simple_mock_model.mof |
| mockalltypes | | tests/unit/all_types.mof |
| mockassoc | | tests/unit/simple_assoc_mock_model.mof |
| mockext | | tests/unit/simple_mock_model_ext.mof |
| op | http://localhost | |
| test3 | | tests/unit/simple_mock_model.mof |
| | | tests/unit/mock_confirm_y.py |
+--------------+------------------+----------------------------------------+
A more complete display of the server parameters is available with the –full option as follows:
pywbemcli> connection list --full
WBEM server connections(full): (#: default, *: current)
+--------------+----------------------+------------------------+-------------+-----------+------------+----------+------------+-----------+--------------------------------------------------+
| name | server | namespace | user | timeout | use_pull | verify | certfile | keyfile | mock-server |
+==============+======================+========================+=============+===========+============+==========+============+===========+==================================================+
| #mockassoc | | root/cimv2 | | 30 | | True | | | tests/unit/simple_assoc_mock_model.mof |
+--------------+----------------------+------------------------+-------------+-----------+------------+----------+------------+-----------+--------------------------------------------------+
| alltypes | | root/cimv2 | | 30 | | True | | | tests/unit/all_types.mof |
+--------------+----------------------+------------------------+-------------+-----------+------------+----------+------------+-----------+--------------------------------------------------+
| complexassoc | | root/cimv2 | | 30 | | True | | | tests/unit/complex_assoc_model.mof |
+--------------+----------------------+------------------------+-------------+-----------+------------+----------+------------+-----------+--------------------------------------------------+
| mock1 | | root/cimv2 | | 30 | | True | | | tests/unit/simple_mock_model.mof |
+--------------+----------------------+------------------------+-------------+-----------+------------+----------+------------+-----------+--------------------------------------------------+
| mock1ext | | root/cimv2 | | 30 | | True | | | tests/unit/simple_mock_model_ext.mof |
+--------------+----------------------+------------------------+-------------+-----------+------------+----------+------------+-----------+--------------------------------------------------+
| mock1interop | | interop | | 30 | | True | | | tests/unit/simple_mock_model.mof |
+--------------+----------------------+------------------------+-------------+-----------+------------+----------+------------+-----------+--------------------------------------------------+
| ophttp | http://localhost | root/cimv2 | | 30 | | True | | | |
+--------------+----------------------+------------------------+-------------+-----------+------------+----------+------------+-----------+--------------------------------------------------+
| ophttps | https://localhost | root/cimv2 | blahblah | 30 | | False | | | |
+--------------+----------------------+------------------------+-------------+-----------+------------+----------+------------+-----------+--------------------------------------------------+
| opt | https://blah | root/cimv2 | | 45 | | False | c1.pem | k1.pem | |
+--------------+----------------------+------------------------+-------------+-----------+------------+----------+------------+-----------+--------------------------------------------------+
| test1 | | root/cimv2 | | 30 | | True | | | tests/unit/simple_assoc_mock_model.mof |
+--------------+----------------------+------------------------+-------------+-----------+------------+----------+------------+-----------+--------------------------------------------------+
Connection list does not display some fields such as the ca-certs field. See connection show command for more detailed display of individual fields used by the server.
See pywbemcli connection list –help for the exact help output of the command.
connection save
command¶
The connection save
command saves the current connection in the
connections file as a connection definition with the name specified
in the NAME
argument.
If a connection definition with that name already exists, it will be overwritten without notice.
See pywbemcli connection save –help for the exact help output of the command.
connection select
command¶
The connection select
command selects a connection definition from the
connections file to become the current connection.
If the NAME
argument is specified, the connection definition with that name
is selected. Otherwise, the command displays the list of connection definitions
and prompts the user to pick the one to be selected. If there is only a
single connection, that connection is selected without the user
request.
If the --default
/-d
command option is set, the connection definition in
addition becomes the default connection, by marking it accordingly in the
connections file.
The following example shows changing connection from within the interactive mode of pywbemcli:
$ pywbemcli
pywbemcli> connection select
Select a connection or Ctrl_C to abort.
0: mock1
1: mockassoc
2: op
Input integer between 0 and 2 or Ctrl-C to exit selection: 1 << entered by user
pywbemcli> connection list
WBEMServer Connections: (#: default, *: current)
+------------+------------------+-------------+-------------+-----------+------------+-----------------------------------------+
| name | server | namespace | user | timeout | verify | mock-server |
|------------+------------------+-------------+-------------+-----------+------------+-----------------------------------------|
| mock1 | | root/cimv2 | | 30 | False | tests/unit/simple_mock_model.mof |
| *mockassoc | | root/cimv2 | | 30 | False | tests/unit/simple_assoc_mock_model.mof |
| op | http://localhost | root/cimv2 | me | 30 | True | |
+------------+------------------+-------------+-------------+-----------+------------+-----------------------------------------+
pywbemcli> connection show
name: mockassoc
server: None
default-namespace: root/cimv2
user: None
password: None
timeout: 30
no-verify: False
certfile: None
keyfile: None
use-pull: either
pull-max-cnt: 1000
mock-server: tests/unit/simple_assoc_mock_model.mof
log: None
See pywbemcli connection select –help for the exact help output of the command.
connection show
command¶
The connection show
command shows information about a connection definition:
If
NAME
is?
, pywbemcli prompts the user to select one and shows the existing current connection. If there is only a single connection the user selection is bypassed.If
NAME
is specified, show the connection definition with that name.If
NAME
is not specified, show the existing current connection.
pywbemcli -s http://blah connection show
name: not-saved (current)
server: http://blah
default-namespace: root/cimv2
user: None
password: None
timeout: 30
verify: True
certfile: None
keyfile: None
mock-server:
ca-certs: None
See pywbemcli connection show –help for the exact help output of the command.
connection test
command¶
The connection test
command executes a single predefined operation on
the current connection to verify that accessing the WBEM server works.
The predefined operation is EnumerateClasses
which attempts to enumerate
the classes in the default namespace of the WBEM Server. Even if the server
does not support the classes operations, this command should return a
CIMError indicating that WBEM is supported (ex. CIM_ERR_NOT_SUPPORTED)
indicating that WBEM is supported by the server.
If the –test-pull command option is included, pywbemcli will issue an instances request for each of the DMTF defined pull operations and report the results. This could be important because the pull operations are defined as optional and some server may not include them.
If the server accepts the request, a simple text OK <server url
will be returned.
The following example defines the connection with --server
, --user
,
and --password
and executes the test with successful result:
$ pywbemcli --server http://localhost --user me --password mypw connection test
Connection successful
See pywbemcli connection test –help for the exact help output of the command.
repl
command¶
The repl
command sets pywbemcli into the Interactive mode. Pywbemcli
can be started in the Interactive mode either by entering:
$ pywbemcli repl
Enter 'help' for help, <CTRL-D> or ':q' to exit pywbemcli.
pywbemcli>
or by executing the script without any command or command group:
$ pywbemcli
Enter 'help' for help, <CTRL-D> or ':q' to exit pywbemcli.
pywbemcli>
The repl mode is recognized by the prompt pywbemcli>
.
Command history is available in the Interactive mode either by using <UP-ARROW> and <DOWN-ARROW> keys to step through the history file or by using incremental search of the command history.
An incremental search is initiated by <CTRL-r> (similar to some shells like bash) and does a search based on a string entered after the <CTRL-r> for the last command containing the search string. The search string may be modified and <UP_ARROW>, <DOWN-ARROW> will find other commands containing the search string. Hitting <ENTER> selects the currently shown command.
see Interactive mode for more details on using this mode and the search.
help
command¶
The help
command provides information on special commands and controls
that can be executed in the Interactive mode including:
executing shell commands,
exiting pywbemcli,
getting help on commands,
viewing interactive mode command history.
This is different from the --help
option that provides information on
command groups, and commands.
$ pywbemcli help
The following can be entered in interactive mode:
<pywbemcli-cmd> Execute pywbemcli command <pywbemcli-cmd>.
!<shell-cmd> Execute shell command <shell-cmd>.
<CTRL-D>, :q, :quit, :exit Exit interactive mode.
<TAB> Tab completion (can be used anywhere).
-h, --help Show pywbemcli general help message, including a
list of pywbemcli commands.
<pywbemcli-cmd> --help Show help message for pywbemcli command
<pywbemcli-cmd>.
help Show this help message.
:?, :h, :help Show help message about interactive mode.
<up-arrow, down-arrow> View pwbemcli command history:
pywbemcli Help Command Details¶
This section shows the help text for each pywbemcli command group and command.
Help text for pywbemcli
:
Usage: pywbemcli [GENERAL-OPTIONS] COMMAND [ARGS] [COMMAND-OPTIONS]
Pywbemcli is a command line WBEM client that uses the DMTF CIM-XML protocol to communicate with WBEM servers.
Pywbemcli can:
* Manage the information in WBEM servers CIM objects using the
operations defined in the DMTF specification. It can manage CIM
classes, CIM instances and CIM qualifier declarations in the WBEM
Server and execute CIM methods and queries on the server.
* Inspect WBEM server characteristics including namespaces, registered
profiles, and other server information.
* Capture detailed information on communication with the WBEM
server including time statistics and logs of the operations.
* Maintain a persistent list of named connections to WBEM servers
and execute operations on them by name.
Pywbemcli implements command groups and commands to execute the CIM-XML operations defined by the DMTF CIM
Operations Over HTTP specification (DSP0200).
The general options shown below can also be specified on any of the commands, positioned right after the 'pywbemcli'
command name.
The width of help texts of this command can be set with the PYWBEMCLI_TERMWIDTH environment variable.
For more detailed documentation, see:
https://pywbemtools.readthedocs.io/en/stable/
General Options:
-n, --name NAME Use the WBEM server defined by the WBEM connection definition NAME. This option is
mutually exclusive with the --server and --mock-server options, since each defines a
WBEM server. Default: EnvVar PYWBEMCLI_NAME, or none.
-m, --mock-server FILE Use a mock WBEM server that is automatically created in pywbemcli and populated with
CIM objects that are defined in the specified MOF file or Python script file. The
files may be specified with relative or absolute path.See the pywbemcli documentation
for more information. This option may be specified multiple times, and is mutually
exclusive with the --server and --name options, since each defines a WBEM server.
Default: EnvVar PYWBEMCLI_MOCK_SERVER, or none.
-s, --server URL Use the WBEM server at the specified URL with format: [SCHEME://]HOST[:PORT]. SCHEME
must be "https" (default) or "http". HOST is a short or long hostname or literal
IPV4/v6 address. PORT defaults to 5989 for https and 5988 for http. This option is
mutually exclusive with the --mock-server and --name options, since each defines a
WBEM server. Default: EnvVar PYWBEMCLI_SERVER, or none.
-u, --user TEXT User name for the WBEM server. Use "" to set default in interactive mode.Default:
EnvVar PYWBEMCLI_USER, or none.
-p, --password TEXT Password for the WBEM server. Default: EnvVar PYWBEMCLI_PASSWORD, or prompted for if
--user specified. Use "" to set default in interactive mode.
--verify / --no-verify If --verify, client verifies the X.509 server certificate presented by the WBEM server
during TLS/SSL handshake. If --no-verify client bypasses verification. Default: EnvVar
PYWBEMCLI_VERIFY, or "--verify".
--ca-certs CACERTS Certificates used to validate the certificate presented by the WBEM server during
TLS/SSL handshake: FILE: Use the certs in the specified PEM file; DIR: Use the certs
in the PEM files in the specified directory; "certifi" (pywbem 1.0 or later): Use the
certs provided by the certifi Python package; Default: EnvVar PYWBEMCLI_CA_CERTS, or
"certifi" (pywbem 1.0 or later), or the certs in the PEM files in the first existing
directory from from a system defined list of directories (pywbem before 1.0).
-c, --certfile FILE Path name of a PEM file containing a X.509 client certificate that is used to enable
TLS/SSL 2-way authentication by presenting the certificate to the WBEM server during
TLS/SSL handshake. Use "" to set default in interactive mode. Default: EnvVar
PYWBEMCLI_CERTFILE, or none.
-k, --keyfile FILE Path name of a PEM file containing a X.509 private key that belongs to the certificate
in the --certfile file. Not required if the private key is part of the --certfile
file. Use "" to set default in interactive mode.Default: EnvVar PYWBEMCLI_KEYFILE, or
none.
-t, --timeout INT Client-side timeout in seconds for operations with the WBEM server. Default: EnvVar
PYWBEMCLI_TIMEOUT, or 30.
-U, --use-pull [yes|no|either] Determines whether pull operations are used for operations with the WBEM server that
return lists of instances, as follows: "yes" uses pull operations and fails if not
supported by the server; "no" uses traditional operations; "either" (default) uses
pull operations if supported by the server, and otherwise traditional operations.
Default: EnvVar PYWBEMCLI_USE_PULL, or "either".
--pull-max-cnt INT Maximum number of instances to be returned by the WBEM server in each open or pull
response, if pull operations are used. This is a tuning parameter that does not affect
the external behavior of the commands. Default: EnvVar PYWBEMCLI_PULL_MAX_CNT, or 1000
-T, --timestats / --no-timestats
Display operation time statistics gathered by pywbemcli after each command. Otherwise
statistics can be displayed with "statistics show" command. Default: EnvVar
PYWBEMCLI_TIMESTATS, or no-timestats.
-d, --default-namespace NAMESPACE
Default namespace, to be used when commands do not specify the --namespace command
option. Use "" to set default in interactive mode. Default: EnvVar
PYWBEMCLI_DEFAULT_NAMESPACE, or root/cimv2.
-o, --output-format FORMAT Output format for the command result. The default and allowed output formats are
command specific. The default output_format is None so that each command selects its
own default format. Use "" to set default in interactive mode. FORMAT is: table
formats: [table|plain|simple|grid|psql|rst|html]; CIM object formats:
[mof|xml|repr|txt]]; TEXT formats: [text].
-l, --log COMP[=DEST[:DETAIL]],...
Enable logging of the WBEM operations, defined by a list of log configuration strings
with: COMP: [api|http|all]; DEST: [file|stderr|off], default: file; DETAIL:
[all|paths|summary], default: all. Use "" to set default in interactive modeDefault:
EnvVar PYWBEMCLI_LOG, or all.
-v, --verbose / --no-verbose Display extra information about the processing.
--warn / --no-warn Warnings control: True enables display of all Python warnings; False leaves warning
control to the PYHONWARNINGS env var, which by default displays no warnings. Default:
False.
-C, --connections-file FILE PATH
Path name of the connections file to be used. Default: EnvVar
PYWBEMCLI_CONNECTIONS_FILE, or ".pywbemcli_connections.yaml" in the user's home
directory (as determined using Python's os.path.expanduser("~"). See there for
details, particularly for Windows). Use "" to set default in interactive mode.
--pdb Pause execution in the built-in pdb debugger just before executing the command within
pywbemcli. Ignored in interactive mode, but can be specified on each interactive
command. Default: EnvVar PYWBEMCLI_PDB, or false.
--version Show the version of this command and the pywbem package.
-h, --help Show this help message.
Commands:
class Command group for CIM classes.
instance Command group for CIM instances.
namespace Command group for CIM namespaces.
profile Command group for WBEM management profiles.
qualifier Command group for CIM qualifier declarations.
server Command group for WBEM servers.
statistics Command group for WBEM operation statistics.
connection Command group for WBEM connection definitions.
help Show help message for interactive mode.
repl Enter interactive mode (default).
pywbemcli class –help¶
Help text for pywbemcli class
(see class command group):
Usage: pywbemcli [GENERAL-OPTIONS] class COMMAND [ARGS] [COMMAND-OPTIONS]
Command group for CIM classes.
This command group defines commands to inspect classes, invoke methods on classes, delete classes.
Creation and modification of classes is not currently supported.
In addition to the command-specific options shown in this help text, the general options (see 'pywbemcli --help')
can also be specified before the 'class' keyword.
Command Options:
-h, --help Show this help message.
Commands:
enumerate List top classes or subclasses of a class in a namespace.
get Get a class.
delete Delete a class.
invokemethod Invoke a method on a class.
references List the classes referencing a class.
associators List the classes associated with a class.
find List the classes with matching class names on the server.
tree Show the subclass or superclass hierarchy for a class.
pywbemcli class associators –help¶
Help text for pywbemcli class associators
(see class associators command):
Usage: pywbemcli [GENERAL-OPTIONS] class associators CLASSNAME [COMMAND-OPTIONS]
List the classes associated with a class.
List the CIM classes that are associated with the specified class (CLASSNAME argument) in the specified CIM
namespace (--namespace option). If no namespace was specified, the default namespace of the connection is used.
The classes to be retrieved can be filtered by the --role, --result-role, --assoc-class, and --result-class options.
The --include-classorigin, --no-qualifiers, and --propertylist options determine which parts are included in each
retrieved class.
The --names-only option can be used to show only the class paths.
In the output, the classes and class paths will be formatted as defined by the --output-format general option. Table
formats on classes will be replaced with MOF format.
Examples:
pywbemcli -n myconn class associators CIM_Foo -n interop
Command Options:
--ac, --assoc-class CLASSNAME Filter the result set by association class name. Subclasses of the specified class
also match.
--rc, --result-class CLASSNAME Filter the result set by result class name. Subclasses of the specified class also
match.
-r, --role PROPERTYNAME Filter the result set by source end role name.
--rr, --result-role PROPERTYNAME
Filter the result set by far end role name.
--nq, --no-qualifiers Do not include qualifiers in the returned class(es). Default: Include qualifiers.
--ico, --include-classorigin Include class origin information in the returned class(es). Default: Do not include
class origin information.
--pl, --propertylist PROPERTYLIST
Filter the properties included in the returned object(s). Multiple properties may be
specified with either a comma-separated list or by using the option multiple times.
Properties specified in this option that are not in the object(s) will be ignored. The
empty string will include no properties. Default: Do not filter properties.
--no, --names-only Retrieve only the object paths (names). Default: Retrieve the complete objects
including object paths.
-n, --namespace NAMESPACE Namespace to use for this command, instead of the default namespace of the connection.
-s, --summary Show only a summary (count) of the objects.
-h, --help Show this help message.
pywbemcli class delete –help¶
Help text for pywbemcli class delete
(see class delete command):
Usage: pywbemcli [GENERAL-OPTIONS] class delete CLASSNAME [COMMAND-OPTIONS]
Delete a class.
Delete a CIM class (CLASSNAME argument) in a CIM namespace (--namespace option). If no namespace was specified, the
default namespace of the connection is used.
If the class has instances, the command is rejected, unless the --include-instances option is specified, in which
case the instances are also deleted.
If other classes in that namespace depend on the class to be deleted, the command is rejected. Dependencies
considered for this purpose are subclasses, referencing classes and embedding classes (EmbeddedInstance qualifier
only).
WARNING: Deletion of instances will cause the removal of corresponding resources in the managed environment (i.e. in
the real world). Some instances may not be deletable.
WARNING: Deleting classes can cause damage to the server: It can impact instance providers and other components in
the server. Use this command with caution.
Many WBEM servers may not allow this operation or may severely limit the conditions under which a class can be
deleted from the server.
Example:
pywbemcli -n myconn class delete CIM_Foo -n interop
Command Options:
-f, --force Same as --include-instances. The -f / --force option has been deprecated and will be
removed in a future version.
--include-instances Delete any instances of the class as well. WARNING: Deletion of instances will cause the
removal of corresponding resources in the managed environment (i.e. in the real
world).Default: Reject command if the class has any instances.
--dry-run Enable dry-run mode: Do not actually delete the objects, but display what would be done.
-n, --namespace NAMESPACE Namespace to use for this command, instead of the default namespace of the connection.
-h, --help Show this help message.
pywbemcli class enumerate –help¶
Help text for pywbemcli class enumerate
(see class enumerate command):
Usage: pywbemcli [GENERAL-OPTIONS] class enumerate CLASSNAME [COMMAND-OPTIONS]
List top classes or subclasses of a class in a namespace.
Enumerate CIM classes starting either at the top of the class hierarchy in the specified CIM namespace (--namespace
option), or at the specified class (CLASSNAME argument) in the specified namespace. If no namespace was specified,
the default namespace of the connection is used.
The --local-only, --include-classorigin, and --no-qualifiers options determine which parts are included in each
retrieved class.
The --deep-inheritance option defines whether or not the complete subclass hierarchy of the classes is retrieved.
The --names-only option can be used to show only the class paths.
In the output, the classes and class paths will be formatted as defined by the --output-format general option. Table
formats on classes will be replaced with MOF format.
Examples:
pywbemcli -n myconn class enumerate -n interop
pywbemcli -n myconn class enumerate CIM_Foo -n interop
Command Options:
--di, --deep-inheritance Include the complete subclass hierarchy of the requested classes in the result set.
Default: Do not include subclasses.
--lo, --local-only Do not include superclass properties and methods in the returned class(es). Default:
Include superclass properties and methods.
--nq, --no-qualifiers Do not include qualifiers in the returned class(es). Default: Include qualifiers.
--ico, --include-classorigin Include class origin information in the returned class(es). Default: Do not include
class origin information.
--no, --names-only Retrieve only the object paths (names). Default: Retrieve the complete objects
including object paths.
-n, --namespace NAMESPACE Namespace to use for this command, instead of the default namespace of the connection.
-s, --summary Show only a summary (count) of the objects.
--association / --no-association
Filter the returned classes to return only indication classes (--association) or
classes that are not associations(--no-association). If the option is not defined no
filtering occurs
--indication / --no-indication Filter the returned classes to return only indication classes (--indication) or
classes that are not indications (--no-indication). If the option is not defined no
filtering occurs
--experimental / --no-experimental
Filter the returned classes to return only experimental classes (--experimental) or
classes that are not experimental (--no-iexperimental). If the option is not defined
no filtering occurs
--deprecated / --no-deprecated Filter the returned classes to return only deprecated classes (--deprecated) or
classes that are not deprecated (--no-deprecated). If the option is not defined no
filtering occurs
--since VERSION Filter the returned classes to return only classes with a version qualifier ge the
supplied string. The string must define a version of the form M.N.V consistent the
definitions of the VERSION qualifier.
--schema SCHEMA Filter the returned classes to return only classes where the classname scheme
component (characters before the "_" match the scheme provided.
--subclass-of CLASSNAME Filter the returned classes to return only classes that are a subclass of the option
value.
--leaf-classes Filter the returned classes to return only leaf (classes; classes with no subclass.
-h, --help Show this help message.
pywbemcli class find –help¶
Help text for pywbemcli class find
(see class find command):
Usage: pywbemcli [GENERAL-OPTIONS] class find CLASSNAME-GLOB [COMMAND-OPTIONS]
List the classes with matching class names on the server.
Find the CIM classes whose class name matches the specified wildcard expression (CLASSNAME-GLOB argument) in all CIM
namespaces of the WBEM server, or in the specified namespace (--namespace option).
The CLASSNAME-GLOB argument is a wildcard expression that is matched on class names case insensitively. The special
characters from Unix file name wildcarding are supported ('*' to match zero or more characters, '?' to match a
single character, and '[]' to match character ranges). To avoid shell expansion of wildcard characters, the
CLASSNAME-GLOB argument should be put in quotes.
For example, "pywbem_*" returns classes whose name begins with "PyWBEM_", "pywbem_", etc. "*system*" returns classes
whose names include the case insensitive string "system".
In the output, the classes will be formatted as defined by the --output-format general option if it specifies table
output. Otherwise the classes will be in the form "NAMESPACE:CLASSNAME".
Examples:
pywbemcli -n myconn class find "CIM_*System*" -n interop
pywbemcli -n myconn class find *Foo*
Command Options:
-n, --namespace NAMESPACE Add a namespace to the search scope. May be specified multiple times. Default: Search
in all namespaces of the server.
-s, --sort Sort by namespace. Default is to sort by classname
--association / --no-association
Filter the returned classes to return only indication classes (--association) or
classes that are not associations(--no-association). If the option is not defined no
filtering occurs
--indication / --no-indication Filter the returned classes to return only indication classes (--indication) or
classes that are not indications (--no-indication). If the option is not defined no
filtering occurs
--experimental / --no-experimental
Filter the returned classes to return only experimental classes (--experimental) or
classes that are not experimental (--no-iexperimental). If the option is not defined
no filtering occurs
--deprecated / --no-deprecated Filter the returned classes to return only deprecated classes (--deprecated) or
classes that are not deprecated (--no-deprecated). If the option is not defined no
filtering occurs
--since VERSION Filter the returned classes to return only classes with a version qualifier ge the
supplied string. The string must define a version of the form M.N.V consistent the
definitions of the VERSION qualifier.
--schema SCHEMA Filter the returned classes to return only classes where the classname scheme
component (characters before the "_" match the scheme provided.
--subclass-of CLASSNAME Filter the returned classes to return only classes that are a subclass of the option
value.
--leaf-classes Filter the returned classes to return only leaf (classes; classes with no subclass.
-h, --help Show this help message.
pywbemcli class get –help¶
Help text for pywbemcli class get
(see class get command):
Usage: pywbemcli [GENERAL-OPTIONS] class get CLASSNAME [COMMAND-OPTIONS]
Get a class.
Get a CIM class (CLASSNAME argument) in a CIM namespace (--namespace option). If no namespace was specified, the
default namespace of the connection is used.
The --local-only, --include-classorigin, --no-qualifiers, and --propertylist options determine which parts are
included in each retrieved class.
In the output, the class will be formatted as defined by the --output-format general option. Table formats are
replaced with MOF format.
Example:
pywbemcli -n myconn class get CIM_Foo -n interop
Command Options:
--lo, --local-only Do not include superclass properties and methods in the returned class(es). Default:
Include superclass properties and methods.
--nq, --no-qualifiers Do not include qualifiers in the returned class(es). Default: Include qualifiers.
--ico, --include-classorigin Include class origin information in the returned class(es). Default: Do not include
class origin information.
--pl, --propertylist PROPERTYLIST
Filter the properties included in the returned object(s). Multiple properties may be
specified with either a comma-separated list or by using the option multiple times.
Properties specified in this option that are not in the object(s) will be ignored. The
empty string will include no properties. Default: Do not filter properties.
-n, --namespace NAMESPACE Namespace to use for this command, instead of the default namespace of the connection.
-h, --help Show this help message.
pywbemcli class invokemethod –help¶
Help text for pywbemcli class invokemethod
(see class invokemethod command):
Usage: pywbemcli [GENERAL-OPTIONS] class invokemethod CLASSNAME METHODNAME [COMMAND-OPTIONS]
Invoke a method on a class.
Invoke a static CIM method (METHODNAME argument) on a CIM class (CLASSNAME argument) in a CIM namespace (--namespace
option), and display the method return value and output parameters. If no namespace was specified, the default
namespace of the connection is used.
The method input parameters are specified using the --parameter option, which may be specified multiple times.
Pywbemcli retrieves the class definition from the server in order to verify that the specified input parameters are
consistent with the parameter characteristics in the method definition.
Use the 'instance invokemethod' command to invoke CIM methods on CIM instances.
Example:
pywbemcli -n myconn class invokemethod CIM_Foo methodx -p p1=9 -p p2=Fred
Command Options:
-p, --parameter PARAMETERNAME=VALUE
Specify a method input parameter with its value. May be specified multiple times.
Default: No input parameters.
-n, --namespace NAMESPACE Namespace to use for this command, instead of the default namespace of the connection.
-h, --help Show this help message.
pywbemcli class references –help¶
Help text for pywbemcli class references
(see class references command):
Usage: pywbemcli [GENERAL-OPTIONS] class references CLASSNAME [COMMAND-OPTIONS]
List the classes referencing a class.
List the CIM (association) classes that reference the specified class (CLASSNAME argument) in the specified CIM
namespace (--namespace option). If no namespace was specified, the default namespace of the connection is used.
The classes to be retrieved can be filtered by the --role and --result-class options.
The --include-classorigin, --no-qualifiers, and --propertylist options determine which parts are included in each
retrieved class.
The --names-only option can be used to show only the class paths.
In the output, the classes and class paths will be formatted as defined by the --output-format general option. Table
formats on classes will be replaced with MOF format.
Examples:
pywbemcli -n myconn class references CIM_Foo -n interop
Command Options:
--rc, --result-class CLASSNAME Filter the result set by result class name. Subclasses of the specified class also
match.
-r, --role PROPERTYNAME Filter the result set by source end role name.
--nq, --no-qualifiers Do not include qualifiers in the returned class(es). Default: Include qualifiers.
--ico, --include-classorigin Include class origin information in the returned class(es). Default: Do not include
class origin information.
--pl, --propertylist PROPERTYLIST
Filter the properties included in the returned object(s). Multiple properties may be
specified with either a comma-separated list or by using the option multiple times.
Properties specified in this option that are not in the object(s) will be ignored. The
empty string will include no properties. Default: Do not filter properties.
--no, --names-only Retrieve only the object paths (names). Default: Retrieve the complete objects
including object paths.
-n, --namespace NAMESPACE Namespace to use for this command, instead of the default namespace of the connection.
-s, --summary Show only a summary (count) of the objects.
-h, --help Show this help message.
pywbemcli class tree –help¶
Help text for pywbemcli class tree
(see class tree command):
Usage: pywbemcli [GENERAL-OPTIONS] class tree CLASSNAME [COMMAND-OPTIONS]
Show the subclass or superclass hierarchy for a class.
List the subclass or superclass hierarchy of a CIM class (CLASSNAME argument) or CIM namespace (--namespace option):
- If CLASSNAME is omitted, the complete class hierarchy of the specified namespace is retrieved.
- If CLASSNAME is specified but not --superclasses, the class and its subclass hierarchy in the specified
namespace are retrieved.
- If CLASSNAME and --superclasses are specified, the class and its superclass ancestry up to the top-level class
in the specified namespace are retrieved.
If no namespace was specified, the default namespace of the connection is used.
The class hierarchy will formatted as a ASCII graphical tree; the --output-format general option is ignored.
The --detail options to display extra information about each class including:
- The Version qualifier value if the class includes a version qualifier. This is normally a string with 3
integers
- Information about each class type (Association, Indication, Abstract)
Examples:
# Display the complete class hierarchy from the interop namespace pywbemcli -n myconn class tree -n interop
# Display CIM_Foo an its subclasses from the namespace interop pywbemcli -n myconn class tree CIM_Foo -n interop
# Display CIM_Foo and its superclasses from interop pywbemcli -n myconn class tree CIM_Foo -s -n interop
Command Options:
-s, --superclasses Show the superclass hierarchy. Default: Show the subclass hierarchy.
-d, --detail Show details about the class: the Version, Association, Indication, and Abstact
qualifiers.
-n, --namespace NAMESPACE Namespace to use for this command, instead of the default namespace of the connection.
-h, --help Show this help message.
pywbemcli connection –help¶
Help text for pywbemcli connection
(see connection command group):
Usage: pywbemcli [GENERAL-OPTIONS] connection COMMAND [ARGS] [COMMAND-OPTIONS]
Command group for WBEM connection definitions.
This command group defines commands to manage persistent WBEM connection definitions that have a name. The names of
these connection definitions can then be used as shorthand for the WBEM server or mock server via the '--name'
general option.
The connection definitions are stored in a connections file. By default, the connections file is
'.pywbemcli_connections.yaml' in the user's home directory. The location of the user's home directory depends on the
operating system used. It is determined with Python's 'os.path.expanduser("~")', which works on all operating
systems including Windows. The default path name of the connections file can be overwritten using the
'PYWBEMCLI_CONNECTIONS_FILE' environment variable, or with the '--connections-file' general option.
In addition to the command-specific options shown in this help text, the general options (see 'pywbemcli --help')
can also be specified before the 'connection' keyword.
Command Options:
-h, --help Show this help message.
Commands:
export Export the current connection.
show Show a WBEM connection definition or the current connection.
delete Delete a WBEM connection definition.
select Select a WBEM connection definition as current or default.
test Test the current connection with a predefined WBEM request.
save Save the current connection to a new WBEM connection definition.
list List the WBEM connection definitions.
pywbemcli connection delete –help¶
Help text for pywbemcli connection delete
(see connection delete command):
Usage: pywbemcli [GENERAL-OPTIONS] connection delete NAME [COMMAND-OPTIONS]
Delete a WBEM connection definition.
Delete a named connection definition from the connections file. If the NAME argument is omitted, prompt for
selecting one of the connection definitions in the connections file.
Example:
pywbemcli connection delete blah
Command Options:
-h, --help Show this help message.
pywbemcli connection export –help¶
Help text for pywbemcli connection export
(see connection export command):
Usage: pywbemcli [GENERAL-OPTIONS] connection export [COMMAND-OPTIONS]
Export the current connection.
Display commands that set pywbemcli environment variables to the parameters of the current connection.
Examples:
pywbemcli --name srv1 connection export
pywbemcli --server https://srv1 --user me --password pw connection export
Command Options:
-h, --help Show this help message.
pywbemcli connection list –help¶
Help text for pywbemcli connection list
(see connection list command):
Usage: pywbemcli [GENERAL-OPTIONS] connection list [COMMAND-OPTIONS]
List the WBEM connection definitions.
This command displays all entries in the connections file and the current connection if it exists and is not in the
connections file as a table.
'#' before the name indicates the default connection.
'*' before the name indicates that it is the current connection.
See also the 'connection select' command.
Command Options:
-f, --full If set, display the full table. Otherwise display a brief view(name, server, mock_server columns).
-h, --help Show this help message.
pywbemcli connection save –help¶
Help text for pywbemcli connection save
(see connection save command):
Usage: pywbemcli [GENERAL-OPTIONS] connection save NAME [COMMAND-OPTIONS]
Save the current connection to a new WBEM connection definition.
Save the current connection to the connections file as a connection definition named NAME. The NAME argument is
required. If a connection definition with that name already exists, it is overwritten without warning.
In the interactive mode, general options that are connection related are applied to the current connection before it
is saved.
Examples:
pywbemcli --server https://srv1 connection save mysrv
Command Options:
-h, --help Show this help message.
pywbemcli connection select –help¶
Help text for pywbemcli connection select
(see connection select command):
Usage: pywbemcli [GENERAL-OPTIONS] connection select NAME [COMMAND-OPTIONS]
Select a WBEM connection definition as current or default.
Select the connection definition named NAME from the connections file to be the current connection. The connection
definition in the connections file must exist. If the NAME argument is omitted, a list of connection definitions
from the connections file is presented with a prompt for the user to select a connection definition.
If the --default option is set, the default connection is set to the selected connection definition, in addition.
Once defined, the default connection will be used as a default in future executions of pywbemcli if none of the
server-defining general options (i.e. --server, --mock-server, or --name) was used.
The 'connection list' command marks the current connection with '*' and the default connection with '#'.
Example of selecting a default connection in command mode:
pywbemcli connection select myconn --default
pywbemcli connection show
name: myconn
. . .
Example of selecting just the current connection in interactive mode:
pywbemcli
pywbemcli> connection select myconn
pywbemcli> connection show
name: myconn
. . .
Command Options:
-d, --default If set, the connection is set to be the default connection in the connections file in addition to
setting it as the current connection.
-h, --help Show this help message.
pywbemcli connection show –help¶
Help text for pywbemcli connection show
(see connection show command):
Usage: pywbemcli [GENERAL-OPTIONS] connection show NAME [COMMAND-OPTIONS]
Show a WBEM connection definition or the current connection.
Show the name and attributes of a WBEM connection definition or the current connection, as follows:
* If the NAME argument is specified, display the connection information with that name from the connections file
or the current connection if it is the same name.
* If the NAME argument is '?', the command presents a list of connection definitions from the connections file and
prompts the user to select one, which is then displayed.
* If the NAME argument is omitted, displays the current connection information if there is a current connection.
Example showing a named connection definition:
pywbemcli connection show svr1
name: svr1
...
Example for prompting for a connection definition:
pywbemcli connection show ?
0: svr1
1: svr2
Input integer between 0 and 2 or Ctrl-C to exit selection: : 0
name: svr1
...
Command Options:
--show-password If set, show existing password in results. Otherwise, password is masked
-h, --help Show this help message.
pywbemcli connection test –help¶
Help text for pywbemcli connection test
(see connection test command):
Usage: pywbemcli [GENERAL-OPTIONS] connection test [COMMAND-OPTIONS]
Test the current connection with a predefined WBEM request.
Execute the EnumerateClassNames operation on the default namespace against the current connection to confirm that
the connection exists and is working.
Examples:
pywbemcli --name mysrv connection test
Command Options:
--test-pull If set, the connection is tested to determine if theDMTF defined pull operations (ex.
OpenEnumerateInstancesare implemented since these are optional.
-h, --help Show this help message.
pywbemcli help –help¶
Help text for pywbemcli help
(see help command):
Usage: pywbemcli [GENERAL-OPTIONS] help
Show help message for interactive mode.
Command Options:
-h, --help Show this help message.
pywbemcli instance –help¶
Help text for pywbemcli instance
(see instance command group):
Usage: pywbemcli [GENERAL-OPTIONS] instance COMMAND [ARGS] [COMMAND-OPTIONS]
Command group for CIM instances.
This command group defines commands to inspect instances, to invoke methods on instances, and to create and delete
instances.
Modification of instances is not currently supported.
In addition to the command-specific options shown in this help text, the general options (see 'pywbemcli --help')
can also be specified before the 'instance' keyword.
Command Options:
-h, --help Show this help message.
Commands:
enumerate List the instances of a class.
get Get an instance of a class.
delete Delete an instance of a class.
create Create an instance of a class in a namespace.
modify Modify properties of an instance.
associators List the instances associated with an instance.
references List the instances referencing an instance.
invokemethod Invoke a method on an instance.
query Execute a query on instances in a namespace.
count Count the instances of each class with matching class name.
shrub Show the association shrub for INSTANCENAME.
pywbemcli instance associators –help¶
Help text for pywbemcli instance associators
(see instance associators command):
Usage: pywbemcli [GENERAL-OPTIONS] instance associators INSTANCENAME [COMMAND-OPTIONS]
List the instances associated with an instance.
List the CIM instances that are associated with the specified CIM instance, and display the returned instances, or
instance paths if --names-only was specified.
For information on how to specify the instance using INSTANCENAME and the --key and --namespace options, invoke with
--help-instancename.
The instances to be retrieved can be filtered by the --filter-query, --role, --result-role, --assoc-class, and
--result-class options.
The --include-qualifiers, --include-classorigin, and --propertylist options determine which parts are included in
each retrieved instance.
The --names-only option can be used to show only the instance paths.
In the output, the instances and instance paths will be formatted as defined by the --output-format general option.
Table formats on instances will be replaced with MOF format.
Command Options:
--ac, --assoc-class CLASSNAME Filter the result set by association class name. Subclasses of the specified class
also match.
--rc, --result-class CLASSNAME Filter the result set by result class name. Subclasses of the specified class also
match.
-r, --role PROPERTYNAME Filter the result set by source end role name.
--rr, --result-role PROPERTYNAME
Filter the result set by far end role name.
--iq, --include-qualifiers When traditional operations are used, include qualifiers in the returned instances.
Some servers may ignore this option. By default, and when pull operations are used,
qualifiers will never be included.
--ico, --include-classorigin Include class origin information in the returned instance(s). Some servers may ignore
this option. Default: Do not include class origin information.
--pl, --propertylist PROPERTYLIST
Filter the properties included in the returned object(s). Multiple properties may be
specified with either a comma-separated list or by using the option multiple times.
Properties specified in this option that are not in the object(s) will be ignored. The
empty string will include no properties. Default: Do not filter properties.
--no, --names-only Retrieve only the object paths (names). Default: Retrieve the complete objects
including object paths.
-k, --key KEYNAME=VALUE Value for a key in keybinding of CIM instance name. May be specified multiple times.
Allows defining keys without the issues of quotes. Default: No keybindings provided.
-n, --namespace NAMESPACE Namespace to use for this command, instead of the default namespace of the connection.
-s, --summary Show only a summary (count) of the objects.
--fq, --filter-query QUERY-STRING
When pull operations are used, filter the instances in the result via a filter query.
By default, and when traditional operations are used, no such filtering takes place.
--fql, --filter-query-language QUERY-LANGUAGE
The filter query language to be used with --filter-query. Default: DMTF:FQL.
--hi, --help-instancename Show help message for specifying INSTANCENAME including use of the --key and
--namespace options.
-h, --help Show this help message.
pywbemcli instance count –help¶
Help text for pywbemcli instance count
(see instance count command):
Usage: pywbemcli [GENERAL-OPTIONS] instance count CLASSNAME-GLOB [COMMAND-OPTIONS]
Count the instances of each class with matching class name.
Display the count of instances of each CIM class whose class name matches the specified wildcard expression
(CLASSNAME-GLOB) in all CIM namespaces of the WBEM server, or in the specified namespaces (--namespace option).
This differs from instance enumerate, etc. in that it counts the instances specifically for the classname of each
instance returned, not including subclasses.
The CLASSNAME-GLOB argument is a wildcard expression that is matched on class names case insensitively. The special
characters from Unix file name wildcarding are supported ('*' to match zero or more characters, '?' to match a
single character, and '[]' to match character ranges). To avoid shell expansion of wildcard characters, the
CLASSNAME-GLOB argument should be put in quotes.
If CLASSNAME-GLOB is not specified, then all classes in the specified namespaces are counted (same as when
specifying CLASSNAME-GLOB as "*").
For example, "pywbem_*" returns classes whose name begins with "PyWBEM_", "pywbem_", etc. "*system*" returns classes
whose names include the case insensitive string "system".
This command can take a long time to execute since it potentially enumerates all instance names for all classes in
all namespaces.
Command Options:
-n, --namespace NAMESPACE Add a namespace to the search scope. May be specified multiple times. Default: Search
in all namespaces of the server.
-s, --sort Sort by instance count. Otherwise sorted by class name.
--association / --no-association
Filter the returned classes to return only indication classes (--association) or
classes that are not associations(--no-association). If the option is not defined no
filtering occurs
--indication / --no-indication Filter the returned classes to return only indication classes (--indication) or
classes that are not indications (--no-indication). If the option is not defined no
filtering occurs
--experimental / --no-experimental
Filter the returned classes to return only experimental classes (--experimental) or
classes that are not experimental (--no-iexperimental). If the option is not defined
no filtering occurs
--deprecated / --no-deprecated Filter the returned classes to return only deprecated classes (--deprecated) or
classes that are not deprecated (--no-deprecated). If the option is not defined no
filtering occurs
--since VERSION Filter the returned classes to return only classes with a version qualifier ge the
supplied string. The string must define a version of the form M.N.V consistent the
definitions of the VERSION qualifier.
--schema SCHEMA Filter the returned classes to return only classes where the classname scheme
component (characters before the "_" match the scheme provided.
--subclass-of CLASSNAME Filter the returned classes to return only classes that are a subclass of the option
value.
--leaf-classes Filter the returned classes to return only leaf (classes; classes with no subclass.
-h, --help Show this help message.
pywbemcli instance create –help¶
Help text for pywbemcli instance create
(see instance create command):
Usage: pywbemcli [GENERAL-OPTIONS] instance create CLASSNAME [COMMAND-OPTIONS]
Create an instance of a class in a namespace.
Create a CIM instance of the specified creation class (CLASSNAME argument) in the specified CIM namespace
(--namespace option), with the specified properties (--property options) and display the CIM instance path of the
created instance. If no namespace was specified, the default namespace of the connection is used.
The properties to be initialized and their new values are specified using the --property option, which may be
specified multiple times.
Pywbemcli retrieves the class definition from the server in order to verify that the specified properties are
consistent with the property characteristics in the class definition.
Example:
pywbemcli instance create CIM_blah -P id=3 -P arr="bla bla",foo
Command Options:
-p, --property PROPERTYNAME=VALUE
Initial property value for the new instance. May be specified multiple times. Array
property values are specified as a comma-separated list; embedded instances are not
supported. Default: No initial properties provided.
-V, --verify Prompt for confirmation before performing a change, to allow for verification of
parameters. Default: Do not prompt for confirmation.
-n, --namespace NAMESPACE Namespace to use for this command, instead of the default namespace of the connection.
-h, --help Show this help message.
pywbemcli instance delete –help¶
Help text for pywbemcli instance delete
(see instance delete command):
Usage: pywbemcli [GENERAL-OPTIONS] instance delete INSTANCENAME [COMMAND-OPTIONS]
Delete an instance of a class.
WARNING: Deletion of instances will cause the removal of corresponding resources in the managed environment (i.e. in
the real world). Some instances may not be deletable.
For information on how to specify the instance using INSTANCENAME and the --key and --namespace options, invoke with
--help-instancename.
Command Options:
-k, --key KEYNAME=VALUE Value for a key in keybinding of CIM instance name. May be specified multiple times. Allows
defining keys without the issues of quotes. Default: No keybindings provided.
-n, --namespace NAMESPACE Namespace to use for this command, instead of the default namespace of the connection.
--hi, --help-instancename Show help message for specifying INSTANCENAME including use of the --key and --namespace
options.
-h, --help Show this help message.
pywbemcli instance enumerate –help¶
Help text for pywbemcli instance enumerate
(see instance enumerate command):
Usage: pywbemcli [GENERAL-OPTIONS] instance enumerate CLASSNAME [COMMAND-OPTIONS]
List the instances of a class.
Enumerate the CIM instances of the specified class (CLASSNAME argument), including instances of subclasses in the
specified CIM namespace (--namespace option), and display the returned instances, or instance paths if --names-only
was specified. If no namespace was specified, the default namespace of the connection is used.
The instances to be retrieved can be filtered by the --filter-query option.
The --local-only, --deep-inheritance, --include-qualifiers, --include-classorigin, and --propertylist options
determine which parts are included in each retrieved instance.
The --names-only option can be used to show only the instance paths.
In the output, the instances and instance paths will be formatted as defined by the --output-format general option.
Table formats on instances will be replaced with MOF format.
Command Options:
--lo, --local-only When traditional operations are used, do not include superclass properties in the
returned instances. Some servers may ignore this option. By default, and when pull
operations are used, superclass properties will always be included.
--di, --deep-inheritance Include subclass properties in the returned instances. Default: Do not include
subclass properties.
--iq, --include-qualifiers When traditional operations are used, include qualifiers in the returned instances.
Some servers may ignore this option. By default, and when pull operations are used,
qualifiers will never be included.
--ico, --include-classorigin Include class origin information in the returned instance(s). Some servers may ignore
this option. Default: Do not include class origin information.
--pl, --propertylist PROPERTYLIST
Filter the properties included in the returned object(s). Multiple properties may be
specified with either a comma-separated list or by using the option multiple times.
Properties specified in this option that are not in the object(s) will be ignored. The
empty string will include no properties. Default: Do not filter properties.
-n, --namespace NAMESPACE Namespace to use for this command, instead of the default namespace of the connection.
--no, --names-only Retrieve only the object paths (names). Default: Retrieve the complete objects
including object paths.
-s, --summary Show only a summary (count) of the objects.
--fq, --filter-query QUERY-STRING
When pull operations are used, filter the instances in the result via a filter query.
By default, and when traditional operations are used, no such filtering takes place.
--fql, --filter-query-language QUERY-LANGUAGE
The filter query language to be used with --filter-query. Default: DMTF:FQL.
-h, --help Show this help message.
pywbemcli instance get –help¶
Help text for pywbemcli instance get
(see instance get command):
Usage: pywbemcli [GENERAL-OPTIONS] instance get INSTANCENAME [COMMAND-OPTIONS]
Get an instance of a class.
For information on how to specify the instance using INSTANCENAME and the --key and --namespace options, invoke with
--help-instancename.
The --local-only, --include-qualifiers, --include-classorigin, and --propertylist options determine which parts are
included in the retrieved instance.
In the output, the instance will formatted as defined by the --output-format general option.
Command Options:
--lo, --local-only Do not include superclass properties in the returned instance. Some servers may ignore
this option. Default: Include superclass properties.
--iq, --include-qualifiers Include qualifiers in the returned instance. Not all servers return qualifiers on
instances. Default: Do not include qualifiers.
--ico, --include-classorigin Include class origin information in the returned instance(s). Some servers may ignore
this option. Default: Do not include class origin information.
--pl, --propertylist PROPERTYLIST
Filter the properties included in the returned object(s). Multiple properties may be
specified with either a comma-separated list or by using the option multiple times.
Properties specified in this option that are not in the object(s) will be ignored. The
empty string will include no properties. Default: Do not filter properties.
-k, --key KEYNAME=VALUE Value for a key in keybinding of CIM instance name. May be specified multiple times.
Allows defining keys without the issues of quotes. Default: No keybindings provided.
-n, --namespace NAMESPACE Namespace to use for this command, instead of the default namespace of the connection.
--hi, --help-instancename Show help message for specifying INSTANCENAME including use of the --key and
--namespace options.
-h, --help Show this help message.
pywbemcli instance invokemethod –help¶
Help text for pywbemcli instance invokemethod
(see instance invokemethod command):
Usage: pywbemcli [GENERAL-OPTIONS] instance invokemethod INSTANCENAME METHODNAME [COMMAND-OPTIONS]
Invoke a method on an instance.
Invoke a CIM method (METHODNAME argument) on a CIM instance with the specified input parameters (--parameter
options), and display the method return value and output parameters.
For information on how to specify the instance using INSTANCENAME and the --key and --namespace options, invoke with
--help-instancename.
The method input parameters are specified using the --parameter option, which may be specified multiple times.
Pywbemcli retrieves the class definition of the creation class of the instance from the server in order to verify
that the specified input parameters are consistent with the parameter characteristics in the method definition.
Use the 'class invokemethod' command to invoke CIM methods on CIM classes.
Example:
pywbemcli -n myconn instance invokemethod CIM_x.id='hi" methodx -p id=3
Command Options:
-p, --parameter PARAMETERNAME=VALUE
Specify a method input parameter with its value. May be specified multiple times.
Array property values are specified as a comma-separated list; embedded instances are
not supported. Default: No input parameters.
-k, --key KEYNAME=VALUE Value for a key in keybinding of CIM instance name. May be specified multiple times.
Allows defining keys without the issues of quotes. Default: No keybindings provided.
-n, --namespace NAMESPACE Namespace to use for this command, instead of the default namespace of the connection.
--hi, --help-instancename Show help message for specifying INSTANCENAME including use of the --key and
--namespace options.
-h, --help Show this help message.
pywbemcli instance modify –help¶
Help text for pywbemcli instance modify
(see instance modify command):
Usage: pywbemcli [GENERAL-OPTIONS] instance modify INSTANCENAME [COMMAND-OPTIONS]
Modify properties of an instance.
For information on how to specify the instance using INSTANCENAME and the --key and --namespace options, invoke with
--help-instancename.
The properties to be modified and their new values are specified using the --property option, which may be specified
multiple times.
The --propertylist option allows restricting the set of properties to be modified. Given that the set of properties
to be modified is already determined by the specified --property options, it does not need to be specified.
Example:
pywbemcli instance modify CIM_blah.fred=3 -P id=3 -P arr="bla bla",foo
Command Options:
-p, --property PROPERTYNAME=VALUE
Property to be modified, with its new value. May be specified once for each property
to be modified. Array property values are specified as a comma-separated list;
embedded instances are not supported. Default: No properties modified.
--pl, --propertylist PROPERTYLIST
Reduce the properties to be modified (as per --property) to a specific property list.
Multiple properties may be specified with either a comma-separated list or by using
the option multiple times. The empty string will cause no properties to be modified.
Default: Do not reduce the properties to be modified.
-V, --verify Prompt for confirmation before performing a change, to allow for verification of
parameters. Default: Do not prompt for confirmation.
-k, --key KEYNAME=VALUE Value for a key in keybinding of CIM instance name. May be specified multiple times.
Allows defining keys without the issues of quotes. Default: No keybindings provided.
-n, --namespace NAMESPACE Namespace to use for this command, instead of the default namespace of the connection.
--hi, --help-instancename Show help message for specifying INSTANCENAME including use of the --key and
--namespace options.
-h, --help Show this help message.
pywbemcli instance query –help¶
Help text for pywbemcli instance query
(see instance query command):
Usage: pywbemcli [GENERAL-OPTIONS] instance query QUERY-STRING [COMMAND-OPTIONS]
Execute a query on instances in a namespace.
Execute the specified query (QUERY_STRING argument) in the specified CIM namespace (--namespace option), and display
the returned instances. If no namespace was specified, the default namespace of the connection is used.
In the output, the instances will formatted as defined by the --output-format general option.
Command Options:
--ql, --query-language QUERY-LANGUAGE
The query language to be used with --query. Default: DMTF:CQL.
-n, --namespace NAMESPACE Namespace to use for this command, instead of the default namespace of the connection.
-s, --summary Show only a summary (count) of the objects.
-h, --help Show this help message.
pywbemcli instance references –help¶
Help text for pywbemcli instance references
(see instance references command):
Usage: pywbemcli [GENERAL-OPTIONS] instance references INSTANCENAME [COMMAND-OPTIONS]
List the instances referencing an instance.
List the CIM (association) instances that reference the specified CIM instance, and display the returned instances,
or instance paths if --names-only was specified.
For information on how to specify the instance using INSTANCENAME and the --key and --namespace options, invoke with
--help-instancename.
The instances to be retrieved can be filtered by the --filter-query, --role and --result-class options.
The --include-qualifiers, --include-classorigin, and --propertylist options determine which parts are included in
each retrieved instance.
The --names-only option can be used to show only the instance paths.
In the output, the instances and instance paths will be formatted as defined by the --output-format general option.
Table formats on instances will be replaced with MOF format.
Command Options:
--rc, --result-class CLASSNAME Filter the result set by result class name. Subclasses of the specified class also
match.
-r, --role PROPERTYNAME Filter the result set by source end role name.
--iq, --include-qualifiers When traditional operations are used, include qualifiers in the returned instances.
Some servers may ignore this option. By default, and when pull operations are used,
qualifiers will never be included.
--ico, --include-classorigin Include class origin information in the returned instance(s). Some servers may ignore
this option. Default: Do not include class origin information.
--pl, --propertylist PROPERTYLIST
Filter the properties included in the returned object(s). Multiple properties may be
specified with either a comma-separated list or by using the option multiple times.
Properties specified in this option that are not in the object(s) will be ignored. The
empty string will include no properties. Default: Do not filter properties.
--no, --names-only Retrieve only the object paths (names). Default: Retrieve the complete objects
including object paths.
-k, --key KEYNAME=VALUE Value for a key in keybinding of CIM instance name. May be specified multiple times.
Allows defining keys without the issues of quotes. Default: No keybindings provided.
-n, --namespace NAMESPACE Namespace to use for this command, instead of the default namespace of the connection.
-s, --summary Show only a summary (count) of the objects.
--fq, --filter-query QUERY-STRING
When pull operations are used, filter the instances in the result via a filter query.
By default, and when traditional operations are used, no such filtering takes place.
--fql, --filter-query-language QUERY-LANGUAGE
The filter query language to be used with --filter-query. Default: DMTF:FQL.
--hi, --help-instancename Show help message for specifying INSTANCENAME including use of the --key and
--namespace options.
-h, --help Show this help message.
pywbemcli instance shrub –help¶
Help text for pywbemcli instance shrub
(see instance shrub command):
Usage: pywbemcli [GENERAL-OPTIONS] instance shrub INSTANCENAME [COMMAND-OPTIONS]
Show the association shrub for INSTANCENAME.
The shrub is a view of all of the instance association relationships for a defined INSTANCENAME showing the various
components that are part of the association including Role, AssocClasse,ResultRole, And ResultClas
The default view is a tree view from the INSTANCENAME to associated instances.
Displays the shrub of association components for the association source instance defined by INSTANCENAME.
For information on how to specify the instance using INSTANCENAME and the --key and --namespace options, invoke with
--help-instancename.
Normally the association information is displayed as a tree but it may also be displayed as a table or as one of the
object formats (ex. MOF) of all instances that are part of the shrub if one of the cim object formats is selected
with the global output_format parameter.
Results are formatted as defined by the output format global option.
Command Options:
--ac, --assoc-class CLASSNAME Filter the result set by association class name. Subclasses of the specified class
also match.
--rc, --result-class CLASSNAME Filter the result set by result class name. Subclasses of the specified class also
match.
-r, --role PROPERTYNAME Filter the result set by source end role name.
--rr, --result-role PROPERTYNAME
Filter the result set by far end role name.
-k, --key KEYNAME=VALUE Value for a key in keybinding of CIM instance name. May be specified multiple times.
Allows defining keys without the issues of quotes. Default: No keybindings provided.
-n, --namespace NAMESPACE Namespace to use for this command, instead of the default namespace of the connection.
-s, --summary Show only a summary (count) of the objects.
-f, --fullpath Normally the instance paths in the tree views are by hiding some keys with ~ to make
the tree simpler to read. This includes keys that have the same value for all
instances and the "CreationClassName" key. Whenthis option is used the full instance
paths are displayed.
--hi, --help-instancename Show help message for specifying INSTANCENAME including use of the --key and
--namespace options.
-h, --help Show this help message.
pywbemcli namespace –help¶
Help text for pywbemcli namespace
(see namespace command group):
Usage: pywbemcli [GENERAL-OPTIONS] namespace COMMAND [ARGS] [COMMAND-OPTIONS]
Command group for CIM namespaces.
This command group defines commands to create, delete and list namespaces in a WBEM server.
In addition to the command-specific options shown in this help text, the general options (see 'pywbemcli --help')
can also be specified before the 'namespace' keyword.
Command Options:
-h, --help Show this help message.
Commands:
list List the namespaces of the server.
create Create a namespace on the server.
delete Delete a namespace from the server.
interop Get the Interop namespace of the server.
pywbemcli namespace create –help¶
Help text for pywbemcli namespace create
(see namespace create command):
Usage: pywbemcli [GENERAL-OPTIONS] namespace create NAMESPACE [COMMAND-OPTIONS]
Create a namespace on the server.
Leading and trailing slash (``/``) characters specified in the NAMESPACE argument will be stripped.
The namespace must not yet exist on the server.
The Interop namespace must exist on the server and cannot be created using this command, because that namespace is
required to implement client requests to manage namespaces.
WBEM servers may not allow this operation or may severely limit the conditions under which a namespace can be
created on the server.
Example:
pywbemcli -n myconn namespace create root/cimv2
Command Options:
-h, --help Show this help message.
pywbemcli namespace delete –help¶
Help text for pywbemcli namespace delete
(see namespace delete command):
Usage: pywbemcli [GENERAL-OPTIONS] namespace delete NAMESPACE [COMMAND-OPTIONS]
Delete a namespace from the server.
Leading and trailing slash (``/``) characters specified in the NAMESPACE argument will be stripped.
The Interop namespace must exist on the server and cannot be deleted using this command.
The targeted namespace must exist on the server. If the namespace contains any objects (qualifier types, classes or
instances), the command is rejected unless the --include-objects option is specified.
If the --include-objects option is specified, the dependency order of classes is determined, and the instances are
deleted first in that order, then the classes in that order, and at last the qualifier types. This ensures that no
dangling dependencies remain at any point in the operation. Dependencies that are considered for this purpose are
subclasses, referencing classes and embedding classes (EmbeddedInstance qualifier only). Cross-namespace
associations are deleted in the targeted namespace and are assumed to be properly handled by the server in the other
namespace. (i.e. to be cleaned up there as well without requiring a deletion by the client).
WARNING: Deletion of instances will cause the removal of corresponding resources in the managed environment (i.e. in
the real world). Some instances may not be deletable.
WARNING: Deletion of classes or qualifier types can cause damage to the server: It can impact instance providers and
other components in the server. WBEM servers may not allow the deletion of classes or qualifier declarations.
WBEM servers may not allow deletion of namespaces or may severely limit the conditions under which a namespace can
be deleted.
Example:
pywbemcli -n myconn namespace delete root/cimv2
Command Options:
--include-objects Delete any objects in the namespace as well. WARNING: Deletion of instances will cause the removal
of corresponding resources in the managed environment (i.e. in the real world). Default: Reject
command if the namespace has any objects.
--dry-run Enable dry-run mode: Do not actually delete the objects, but display what would be done.
-h, --help Show this help message.
pywbemcli namespace interop –help¶
Help text for pywbemcli namespace interop
(see namespace interop command):
Usage: pywbemcli [GENERAL-OPTIONS] namespace interop [COMMAND-OPTIONS]
Get the Interop namespace of the server.
The Interop namespace must exist on the server.
Command Options:
-h, --help Show this help message.
pywbemcli namespace list –help¶
Help text for pywbemcli namespace list
(see namespace list command):
Usage: pywbemcli [GENERAL-OPTIONS] namespace list [COMMAND-OPTIONS]
List the namespaces of the server.
The Interop namespace must exist on the server.
Examples:
pywbemcli -n myconn namespace list
Command Options:
-h, --help Show this help message.
pywbemcli profile –help¶
Help text for pywbemcli profile
(see profile command group):
Usage: pywbemcli [GENERAL-OPTIONS] profile COMMAND [ARGS] [COMMAND-OPTIONS]
Command group for WBEM management profiles.
This command group defines commands to inspect and manage the WBEM management profiles maintained by the WBEM
server.
In addition to the command-specific options shown in this help text, the general options (see 'pywbemcli --help')
can also be specified before the 'server' keyword.
Command Options:
-h, --help Show this help message.
Commands:
list List WBEM management profiles advertised by the server.
centralinsts List WBEM management profile central instances on the server.
pywbemcli profile centralinsts –help¶
Help text for pywbemcli profile centralinsts
(see profile centralinsts command):
Usage: pywbemcli [GENERAL-OPTIONS] profile centralinsts [COMMAND-OPTIONS]
List WBEM management profile central instances on the server.
Retrieve the CIM instances that are central instances of the specified WBEM management profiles, and display these
instances. By default, all management profiles advertized on the server are included. The profiles can be filtered
by using the --organization and --profile options.
The central instances are determined using all methodologies defined in DSP1033 V1.1 in the order of
GetCentralInstances, central class, and scoping class methodology.
Profiles that only use the scoping class methodology require the specification of the --central-class, --scoping-
class, and --scoping-path options because additional information is needed to perform the scoping class methodology.
The retrieved central instances are displayed along with the organization, name, and version of the profile they
belong to, formatted as a table. The --output-format general option is ignored unless it specifies a table format.
Command Options:
-o, --organization ORG-NAME Filter by the defined organization. (ex. -o DMTF
-p, --profile PROFILE-NAME Filter by the profile name. (ex. -p Array
--cc, --central-class CLASSNAME
Optional. Required only if profiles supports only scoping methodology
--sc, --scoping-class CLASSNAME
Optional. Required only if profiles supports only scoping methodology
--sp, --scoping-path CLASSLIST Optional. Required only if profiles supports only scoping methodology. Multiples
allowed
--rd, --reference-direction [snia|dmtf]
Navigation direction for association. [default: dmtf]
-h, --help Show this help message.
pywbemcli profile list –help¶
Help text for pywbemcli profile list
(see Profile list command):
Usage: pywbemcli [GENERAL-OPTIONS] profile list [COMMAND-OPTIONS]
List WBEM management profiles advertised by the server.
Retrieve the WBEM management profiles advertised by the WBEM server, and display information about each profile.
WBEM management profiles are defined by DMTF and SNIA and define the management functionality that is available.
The retrieved profiles can be filtered using the --organization and --profile options.
The output is formatted as a table showing the organization, name, and version for each profile. The --output-format
option is ignored unless it specifies a table format.
Command Options:
-o, --organization ORG-NAME Filter by the defined organization. (ex. -o DMTF
-p, --profile PROFILE-NAME Filter by the profile name. (ex. -p Array
-h, --help Show this help message.
pywbemcli qualifier –help¶
Help text for pywbemcli qualifier
(see qualifier command group):
Usage: pywbemcli [GENERAL-OPTIONS] qualifier COMMAND [ARGS] [COMMAND-OPTIONS]
Command group for CIM qualifier declarations.
This command group defines commands to inspect and delete CIM qualifier declarations in the WBEM Server.
In addition to the command-specific options shown in this help text, the general options (see 'pywbemcli --help')
can also be specified before the 'qualifier' keyword.
Command Options:
-h, --help Show this help message.
Commands:
get Get a qualifier declaration.
delete Delete a qualifier declaration.
enumerate List the qualifier declarations in a namespace.
pywbemcli qualifier delete –help¶
Help text for pywbemcli qualifier delete
(see qualifier delete command):
Usage: pywbemcli [GENERAL-OPTIONS] qualifier delete QUALIFIERNAME [COMMAND-OPTIONS]
Delete a qualifier declaration.
Delete a CIM qualifier declaration (QUALIFIERNAME argument) in a CIM namespace (--namespace option). If no namespace
was specified, the default namespace of the connection is used.
This command executes the DeleteQualifier operation against the WBEM server and leaves it to the WBEM server to
reject the operation if any classes in the namespace use the qualifier.
In the output, the qualifier declaration will formatted as defined by the --output-format general option.
Command Options:
-n, --namespace NAMESPACE Namespace to use for this command, instead of the default namespace of the connection.
-h, --help Show this help message.
pywbemcli qualifier enumerate –help¶
Help text for pywbemcli qualifier enumerate
(see qualifier enumerate command):
Usage: pywbemcli [GENERAL-OPTIONS] qualifier enumerate [COMMAND-OPTIONS]
List the qualifier declarations in a namespace.
Enumerate the CIM qualifier declarations in the specified CIM namespace (--namespace option). If no namespace was
specified, the default namespace of the connection is used.
In the output, the qualifier declaration will formatted as defined by the --output-format general option.
Command Options:
-n, --namespace NAMESPACE Namespace to use for this command, instead of the default namespace of the connection.
-s, --summary Show only a summary (count) of the objects.
-h, --help Show this help message.
pywbemcli qualifier get –help¶
Help text for pywbemcli qualifier get
(see qualifier get command):
Usage: pywbemcli [GENERAL-OPTIONS] qualifier get QUALIFIERNAME [COMMAND-OPTIONS]
Get a qualifier declaration.
Get a CIM qualifier declaration (QUALIFIERNAME argument) in a CIM namespace (--namespace option). If no namespace
was specified, the default namespace of the connection is used.
In the output, the qualifier declaration will formatted as defined by the --output-format general option.
Command Options:
-n, --namespace NAMESPACE Namespace to use for this command, instead of the default namespace of the connection.
-h, --help Show this help message.
pywbemcli repl –help¶
Help text for pywbemcli repl
(see repl command):
Usage: pywbemcli [GENERAL-OPTIONS] repl
Enter interactive mode (default).
Enter the interactive mode where pywbemcli commands can be entered interactively. The prompt is changed to
'pywbemcli>'.
Command history is supported. The command history is stored in a file ~/.pywbemcli_history.
Pywbemcli may be terminated from this mode by entering <CTRL-D>, :q, :quit, :exit
In the repl mode, <CTRL-r> man be used to initiate an interactive search of the history file.
Interactive mode also includes an autosuggest feature that makes suggestions from the command history as the command
the user types in the command and options.
Command Options:
-h, --help Show this help message.
pywbemcli server –help¶
Help text for pywbemcli server
(see server command group):
Usage: pywbemcli [GENERAL-OPTIONS] server COMMAND [ARGS] [COMMAND-OPTIONS]
Command group for WBEM servers.
This command group defines commands to inspect and manage core components of a WBEM server including server
attributes, namespaces, compiling MOF, the Interop namespace, management profiles, and access to profile central
instances.
In addition to the command-specific options shown in this help text, the general options (see 'pywbemcli --help')
can also be specified before the 'server' keyword.
Command Options:
-h, --help Show this help message.
Commands:
namespaces List the namespaces of the server (deprecated).
interop Get the Interop namespace of the server (deprecated).
brand Get the brand of the server.
info Get information about the server.
add-mof Compile MOF and add/update CIM objects in the server.
remove-mof Compile MOF and remove CIM objects from the server.
pywbemcli server add-mof –help¶
Help text for pywbemcli server add-mof
(see server add-mof command):
Usage: pywbemcli [GENERAL-OPTIONS] server add-mof MOFFILE [COMMAND-OPTIONS]
Compile MOF and add/update CIM objects in the server.
The MOF files are specified with the MOFFILE argument, which may be specified multiple times. The minus sign ('-')
specifies the standard input.
Initially, the target namespace is the namespace specified with the --namespace option or if not specified the
default namespace of the connection. If the MOF contains '#pragma namespace' directives, the target namespace will
be changed accordingly.
MOF include files (specified with the '#pragma include' directive) are searched first in the directory of the
including MOF file, and then in the directories specified with the --include option.
Any CIM objects (instances, classes and qualifiers) specified in the MOF files are created in the server, or
modified if they already exist in the server.
The global --verbose option will show the CIM objects that are created or modified.
Command Options:
-n, --namespace NAMESPACE Namespace to use for this command, instead of the default namespace of the connection.
-I, --include INCLUDEDIR Path name of a MOF include directory. May be specified multiple times.
-d, --dry-run Enable dry-run mode: Don't actually modify the server. Connection to the server is still
required for reading.
-h, --help Show this help message.
pywbemcli server brand –help¶
Help text for pywbemcli server brand
(see server brand command):
Usage: pywbemcli [GENERAL-OPTIONS] server brand [COMMAND-OPTIONS]
Get the brand of the server.
Brand information is defined by the server implementor and may or may not be available. Pywbem attempts to collect
the brand information from multiple sources.
Command Options:
-h, --help Show this help message.
pywbemcli server info –help¶
Help text for pywbemcli server info
(see server info command):
Usage: pywbemcli [GENERAL-OPTIONS] server info [COMMAND-OPTIONS]
Get information about the server.
The information includes CIM namespaces and server brand.
Command Options:
-h, --help Show this help message.
pywbemcli server interop –help¶
Help text for pywbemcli server interop
(see server interop command):
Usage: pywbemcli [GENERAL-OPTIONS] server interop [COMMAND-OPTIONS]
Get the Interop namespace of the server (deprecated).
The Interop namespace must exist on the server.
Deprecated: The 'server interop' command is deprecated and will be removed in a future version. Use the 'namespace
interop' command instead.
Command Options:
-h, --help Show this help message.
pywbemcli server namespaces –help¶
Help text for pywbemcli server namespaces
(see server namespaces command):
Usage: pywbemcli [GENERAL-OPTIONS] server namespaces [COMMAND-OPTIONS]
List the namespaces of the server (deprecated).
The Interop namespace must exist on the server.
Deprecated: The 'server namespaces' command is deprecated and will be removed in a future version. Use the
'namespace list' command instead.
Command Options:
-h, --help Show this help message.
pywbemcli server remove-mof –help¶
Help text for pywbemcli server remove-mof
(see server remove-mof command):
Usage: pywbemcli [GENERAL-OPTIONS] server remove-mof MOFFILE [COMMAND-OPTIONS]
Compile MOF and remove CIM objects from the server.
The MOF files are specified with the MOFFILE argument, which may be specified multiple times. The minus sign ('-')
specifies the standard input.
Initially, the target namespace is the namespace specified with the --namespace option or if not specified the
default namespace of the connection. If the MOF contains '#pragma namespace' directives, the target namespace will
be changed accordingly.
MOF include files (specified with the '#pragma include' directive) are searched first in the directory of the
including MOF file, and then in the directories specified with the --include option.
Any CIM objects (instances, classes and qualifiers) specified in the MOF files are deleted from the server.
The global --verbose option will show the CIM objects that are removed.
Command Options:
-n, --namespace NAMESPACE Namespace to use for this command, instead of the default namespace of the connection.
-I, --include INCLUDEDIR Path name of a MOF include directory. May be specified multiple times.
-d, --dry-run Enable dry-run mode: Don't actually modify the server. Connection to the server is still
required for reading.
-h, --help Show this help message.
pywbemcli statistics –help¶
Help text for pywbemcli statistics
(see statistics command group):
Usage: pywbemcli [GENERAL-OPTIONS] statistics COMMAND [ARGS] [COMMAND-OPTIONS]
Command group for WBEM operation statistics.
This command group defines commands to control the gathering and display of statistical data about the WBEM
operations issued by pywbemcli or processed by a WBEM server.
Pywbemcli maintains statistics about the WBEM operations it has issued. This includes the Client Time measured on
the client side and the Server Time measured by the WBEM server and reported in the 'WBEMServerResponseTime' header
field in the CIM-XML response (if supported by the WBEM server).
The WBEM server may also support maintaining statistics about the WBEM operations it has processed (possibly by
multiple clients). Pywbemcli supports enabling or disabling the statistics gathering on the WBEM server via the
'GatherStatisticalData' property in the 'CIM_ObjectManager' instance for the WBEM server and supports retrieving and
displaying the server maintained statistics.
In addition to the command-specific options shown in this help text, the general options (see 'pywbemcli --help')
can also be specified before the 'statistics' keyword.
Command Options:
-h, --help Show this help message.
Commands:
reset Reset client maintained statistics.
server-on Enable server maintained statistics.
server-off Disable server maintained statistics.
server-show Display server maintained statistics.
show Display client maintained statistics.
status Show enabled status of client and server maintained statistics.
pywbemcli statistics reset –help¶
Help text for pywbemcli statistics reset
(see statistics reset command):
Usage: pywbemcli [GENERAL-OPTIONS] statistics reset [COMMAND-OPTIONS]
Reset client maintained statistics.
This command resets the counts in the statistics maintained by pywbemcli. This includes the server response times
received from the WBEM server in the 'WBEMServerResponseTime' header field of the CIM-XML response, if supported and
enabled.
This command does not reset the server maintained statistics.
Command Options:
-h, --help Show this help message.
pywbemcli statistics server-off –help¶
Help text for pywbemcli statistics server-off
(see statistics server-off command):
Usage: pywbemcli [GENERAL-OPTIONS] statistics server-off [COMMAND-OPTIONS]
Disable server maintained statistics.
This command deactivates the gathering of statistics in the current WBEM server and also deactivates the returning
of server response times in the CIM-XML response for inclusion in the client maintained statistics, by setting the
'GatherStatisticalData' property to False in the 'CIM_ObjectManager' instance for the WBEM server.
This command fails if the server does not support gathering statistics or does not allow a client to modify the
state of statistics gathering.
This command does not affect the state of the client maintained statistics other than whether the server response
times are included. See the '--timestats' general option for controlling the displaying of client maintained
statistics.
Command Options:
-h, --help Show this help message.
pywbemcli statistics server-on –help¶
Help text for pywbemcli statistics server-on
(see statistics server-on command):
Usage: pywbemcli [GENERAL-OPTIONS] statistics server-on [COMMAND-OPTIONS]
Enable server maintained statistics.
This command activates the gathering of statistics in the current WBEM server and also activates the returning of
server response times in the CIM-XML response for inclusion in the client maintained statistics, by setting the
'GatherStatisticalData' property to True in the 'CIM_ObjectManager' instance for the WBEM server.
This command fails if the server does not support gathering statistics or does not allow a client to modify the
state of statistics gathering.
This command does not affect the state of the client maintained statistics other than whether the server response
times are included. See the '--timestats' general option for controlling the displaying of client maintained
statistics.
Command Options:
-h, --help Show this help message.
pywbemcli statistics server-show –help¶
Help text for pywbemcli statistics server-show
(see statistics server-show command):
Usage: pywbemcli [GENERAL-OPTIONS] statistics server-show [COMMAND-OPTIONS]
Display server maintained statistics.
Retrieve and display the statistics gathered by the current WBEM server. This requires statistics gathering to be
enabled on the server (see 'statistics server-on' command).
This command fails if the server does not support gathering statistics.
These statistics are independent of the client maintained statistics which can be displayed with the command
'statistics show'.
Command Options:
-h, --help Show this help message.
pywbemcli statistics show –help¶
Help text for pywbemcli statistics show
(see statistics show command):
Usage: pywbemcli [GENERAL-OPTIONS] statistics show [COMMAND-OPTIONS]
Display client maintained statistics.
Display the statistics gathered by pywbemcli. This includes the server response times received from the WBEM server
in the 'WBEMServerResponseTime' header field of the CIM-XML response, if supported and enabled.
These statistics are independent of the server maintained statistics which can be displayed with the command
'statistics server-show'.
Command Options:
-h, --help Show this help message.
pywbemcli statistics status –help¶
Help text for pywbemcli statistics status
(see statistics status command):
Usage: pywbemcli [GENERAL-OPTIONS] statistics status [COMMAND-OPTIONS]
Show enabled status of client and server maintained statistics.
Show the enabled status for displaying the statistics gathered by pywbemcli, and for gathering the statistics on the
current WBEM server.
Command Options:
-h, --help Show this help message.
Mock WBEM server support¶
Mock support overview¶
Pywbemcli supports mocking a WBEM server with the --mock-server general option. This allows executing pywbemcli against a mock WBEM server that is automatically created in pywbemcli, rather than a real WBEM server.
The --mock-server
option is mutually exclusive with the
--server general option and --name general option, since each
defines a WBEM server.
The automatically created mock WBEM server has a in-memory repository for CIM objects (qualifier declarations, classes, and instances) and supports CIM namespaces. The operations performed against the mock WBEM server cause that mock repository to be inspected or manipulated accordingly.
The mock repository can be loaded with CIM objects from files specified as an
argument to the --mock-server
option. Each use of the option
specifies one file path of such a file. The option may be used multiple times
and each specified file is processed sequentially, in the sequence of the
options on the command line.
The following types of files are supported for the --mock-server
option:
MOF files: If the file extension is
.mof
, the file is considered a MOF file. Pywbemcli compiles the MOF in the file and adds the resulting CIM objects to the mock repository.The MOF file may define CIM qualifier declarations, CIM classes and CIM instances.
At this point, these CIM objects can be added to only one CIM namespace in the repository of the mock WBEM server, namely the default namespace of the connection (see --default-namespace general option).
If a CIM object already exists in the repository, it is updated accordingly.
Mock scripts: If the file extension is
.py
, the file is considered a Python mock script.Mock scripts can be used for any kind of setup of the mock WBEM server, for example for creating namespaces, implementing and registering providers, or adding CIM objects either from the corresponding Python objects or by compiling MOF files or MOF strings.
Mock scripts support two approaches for passing the mock WBEM server they should operate on:
New-style: The mock script has a
setup()
function. This is the recommended approach, but it is supported only on Python >=3.5. It enables the mock environment of a connection definition to be cached.New-style mock scripts are imported as a Python module into Python namespace
pywbemtools.pywbemcli.mockscripts.<mock-script-name>
and theirsetup()
function is called. That function has the following interface:def setup(conn, server, verbose): . . .
conn
(pywbem_mock.FakedWBEMConnection
): This object provides a connection to the mock WBEM server. The methods of this object can be used to create and modify CIM objects in the mock repository and to register providers.server
(pywbem.WBEMServer
): This object is layered on top of theCONN
object and provides access to higher level features of the mock WBEM server, such as getting the Interop namespace, adding namespaces, or building more complex objects for the mock repository.verbose
(bool): A flag that contains the value of the boolean --verbose general option of pywbemcli.
Old-style: The mock script does not have a
setup()
function. This approach is not recommended, but it is supported on all supported Python versions. Using old-style mock scripts in a connection definition prevents caching of its mock environment.Old-style mock scripts are executed as Python scripts in Python namespace
__builtin__
, with the following Python global variables made available:CONN
(pywbem_mock.FakedWBEMConnection
): This object provides a connection to the mock WBEM server. The methods of this object can be used to create and modify CIM objects in the mock repository and to register providers.SERVER
(pywbem.WBEMServer
): This object is layered on top of theCONN
object and provides access to higher level features of the mock WBEM server, such as getting the Interop namespace, adding namespaces, or building more complex objects for the mock repository.VERBOSE
(bool): A flag that contains the value of the boolean --verbose general option of pywbemcli.
Mock scripts can for example create Python objects of type
CIMQualifierDeclaration
,CIMClass
andCIMInstance
for representing CIM objects, and add them to the mock repository via calls topywbem_mock.FakedWBEMConnection.add_cimobjects()
.Mock scripts can also implement user-defined providers (see User-defined providers in the pywbem documentation) and register these providers with the mock WBEM server.
Finally, mock scripts can be used to add or update CIM objects in the CIM repository of the mock WBEM server. This is an alternative to specifying MOF files, and can be used for example to parse files defining the CIM objects for entire WBEM management profiles.
It is possible to mix MOF files and mock scripts by specifying the --mock-server general option multiple times.
Pywbemcli logging (see --log general option) can be used together with the mock support. Since the mock support does not use HTTP(S), only the “api” component in the log configuration string will generate any log output.
Setting up the mock WBEM server¶
The following is an example MOF file named tst_file.mof
that defines some
CIM qualifier declarations, a single CIM class, and a single CIM instance of
that class:
# Define some qualifiers
Qualifier Description : string = null,
Scope(any),
Flavor(EnableOverride, ToSubclass, Translatable);
Qualifier In : boolean = true,
Scope(parameter),
Flavor(DisableOverride, ToSubclass);
Qualifier Key : boolean = false,
Scope(property, reference),
Flavor(DisableOverride, ToSubclass);
Qualifier Out : boolean = false,
Scope(parameter),
Flavor(DisableOverride, ToSubclass);
# Define a class
[Description ("Simple CIM Class")]
class CIM_Foo {
[Key, Description("This is a key property")]
string InstanceID;
[Description("This is a uint32 property")]
uint32 IntegerProp;
[Description("Method with one output parameter")]
uint32 TestMethod(
[In (false), Out, Description("Output parameter")]
string OutputParam;
);
};
# Define an instance of the class
instance of CIM_Foo as $foo1 {
InstanceID = "CIM_Foo1";
IntegerProp = 1;
};
The pywbemcli command to use this MOF file for loading into a mock WBEM server, and then to enumerate its CIM class names is:
$ pywbemcli --mock-server tst_file.mof class enumerate --names-only
CIM_Foo
The following is an old-style mock script named tst_script.py
that will add
the same CIM objects as MOF file tst_file.mof
to the mock repository using
add_cimobjects()
. If the
--verbose general option is set on the pywbemcli command line, the
mock repository will be displayed:
#!/usr/bin/env python
from pywbem import CIMQualifierDeclaration, CIMQualifier, CIMClass, \
CIMProperty, CIMMethod, CIMParameter, CIMInstance, CIMInstanceName, Uint32
def main():
# Global variables made available by pywbemcli
global CONN, VERBOSE
# Define some qualifier declarations
description_qd = CIMQualifierDeclaration(
'Description', type='string', value=None,
scopes=dict(ANY=True),
overridable=True, tosubclass=True, translatable=True)
in_qd = CIMQualifierDeclaration(
'In', type='boolean', value=True,
scopes=dict(PARAMETER=True),
overridable=False, tosubclass=True)
key_qd = CIMQualifierDeclaration(
'Key', type='boolean', value=False,
scopes=dict(PROPERTY=True, REFERENCE=True),
overridable=False, tosubclass=True)
out_qd = CIMQualifierDeclaration(
'Out', type='boolean', value=False,
scopes=dict(PARAMETER=True),
overridable=False, tosubclass=True)
# Define a class
foo_cl = CIMClass(
'CIM_Foo',
qualifiers=[
CIMQualifier('Description', 'Simple CIM Class'),
],
properties=[
CIMProperty(
'InstanceID', type='string', value=None,
qualifiers=[
CIMQualifier('Key', True),
CIMQualifier('Description', 'This is a key property'),
],
class_origin='CIM_Foo', propagated=False),
CIMProperty(
'IntegerProp', type='uint32', value=None,
qualifiers=[
CIMQualifier('Key', True),
CIMQualifier('Description', 'This is a uint32 property'),
],
class_origin='CIM_Foo', propagated=False),
],
methods=[
CIMMethod(
'TestMethod', return_type='uint32',
qualifiers=[
CIMQualifier('Description',
'Method with one output parameter'),
],
parameters=[
CIMParameter(
'OutputParam', type='string',
qualifiers=[
CIMQualifier('In', False),
CIMQualifier('Out', True),
CIMQualifier('Description', 'Output parameter'),
]),
],
class_origin='CIM_Foo', propagated=False),
]
)
# Define an instance of the class.
# Note: The mock repository does not add an instance path, so it must be
# prepared upfront.
foo1 = CIMInstance(
'CIM_Foo',
path=CIMInstanceName(
'CIM_Foo', keybindings=dict(InstanceID="CIM_Foo1")),
properties=[
CIMProperty('InstanceID', value="CIM_Foo1"),
CIMProperty('IntegerProp', value=Uint32(1)),
])
# Add the CIM objects to the mock repository
CONN.add_cimobjects([
description_qd, in_qd, key_qd, out_qd,
foo_cl,
foo1,
])
if VERBOSE:
CONN.display_repository()
if __name__ == '__builtin__':
main()
The following is the new-style version of mock script tst_script.py
:
from pywbem import CIMQualifierDeclaration, CIMQualifier, CIMClass, \
CIMProperty, CIMMethod, CIMParameter, CIMInstance, CIMInstanceName, Uint32
def setup(conn, server, verbose):
# Define some qualifier declarations
description_qd = CIMQualifierDeclaration(
'Description', type='string', value=None,
scopes=dict(ANY=True),
overridable=True, tosubclass=True, translatable=True)
in_qd = CIMQualifierDeclaration(
'In', type='boolean', value=True,
scopes=dict(PARAMETER=True),
overridable=False, tosubclass=True)
key_qd = CIMQualifierDeclaration(
'Key', type='boolean', value=False,
scopes=dict(PROPERTY=True, REFERENCE=True),
overridable=False, tosubclass=True)
out_qd = CIMQualifierDeclaration(
'Out', type='boolean', value=False,
scopes=dict(PARAMETER=True),
overridable=False, tosubclass=True)
# Define a class
foo_cl = CIMClass(
'CIM_Foo',
qualifiers=[
CIMQualifier('Description', 'Simple CIM Class'),
],
properties=[
CIMProperty(
'InstanceID', type='string', value=None,
qualifiers=[
CIMQualifier('Key', True),
CIMQualifier('Description', 'This is a key property'),
],
class_origin='CIM_Foo', propagated=False),
CIMProperty(
'IntegerProp', type='uint32', value=None,
qualifiers=[
CIMQualifier('Key', True),
CIMQualifier('Description', 'This is a uint32 property'),
],
class_origin='CIM_Foo', propagated=False),
],
methods=[
CIMMethod(
'TestMethod', return_type='uint32',
qualifiers=[
CIMQualifier('Description',
'Method with one output parameter'),
],
parameters=[
CIMParameter(
'OutputParam', type='string',
qualifiers=[
CIMQualifier('In', False),
CIMQualifier('Out', True),
CIMQualifier('Description', 'Output parameter'),
]),
],
class_origin='CIM_Foo', propagated=False),
]
)
# Define an instance of the class.
# Note: The mock repository does not add an instance path, so it must be
# prepared upfront.
foo1 = CIMInstance(
'CIM_Foo',
path=CIMInstanceName(
'CIM_Foo', keybindings=dict(InstanceID="CIM_Foo1")),
properties=[
CIMProperty('InstanceID', value="CIM_Foo1"),
CIMProperty('IntegerProp', value=Uint32(1)),
])
# Add the CIM objects to the mock repository
conn.add_cimobjects([
description_qd, in_qd, key_qd, out_qd,
foo_cl,
foo1,
])
if verbose:
conn.display_repository()
The pywbemcli command to use this mock script, and then to enumerate its CIM class names is:
$ pywbemcli --mock-server tst_script.py class enumerate --names-only
CIM_Foo
As you can see, adding CIM objects with a MOF file is more compact than doing that in a mock script, but of course the mock script can contain logic, and it allows defining providers.
The following new-style mock script defines and registers a method provider for CIM method “CIM_Foo.Method1()” that modifies property “Property1” of the target CIM instance and returns that property in an output parameter “OutputParam1”:
from pywbem import CIMInstanceName, CIMError, \\
CIM_ERR_INVALID_PARAMETER, CIM_ERR_METHOD_NOT_AVAILABLE
from pywbem_mock import MethodProvider
class CIM_Foo_MethodProvider(MethodProvider):
provider_classname = 'CIM_Foo'
def InvokeMethod(self, methodname, localobject, params):
if methodname.lower() == 'method1':
if isinstance(localobject, CIMClassName):
raise CIMError(
CIM_ERR_INVALID_PARAMETER,
"CIM method {0} must be invoked on a CIM instance".
format(methodname))
return self.Method1(localobject, params)
else:
raise CIMError(CIM_ERR_METHOD_NOT_AVAILABLE)
def Method1(self, localobject, params):
namespace = localobject.namespace
instance_store = self.cimrepository.get_instance_store(namespace)
# Get the instance the method was invoked on, from the CIM
# repository (as a copy)
instance = instance_store.get(localobject.path) # a copy
# Modify a property value in the local copy of the instance
if 'Property1' not in instance.properties:
instance.properties['Property1'] = 'new'
instance.properties['Property1'] += '+'
# Update the instance in the CIM repository from the changed
# local instance
instance_store.update(localobject.path, instance)
# Return the property value in the output parameter
outputparam1 = instance.properties['Property1']
out_params = [
CIMParameter('OutputParam1', type='string', value=outputparam1),
]
# Set the return value of the CIM method
return_value = 0
return (return_value, out_params)
def setup(conn, server, verbose):
provider = CIM_Foo_MethodProvider(conn.cimrepository)
conn.register_provider(provider, conn.default_namespace, verbose=verbose)
Caching of mock WBEM servers¶
Pywbemcli automatically attempts to cache the mock WBEM server of a connection definition. If the connection definition specifies only MOF files and new-style mock scripts, that attempt will normally succeed. If it specifies any old-style mock script, or if any MOF file fails to compile, or if any mock script raises an exception, the mock WBEM server will not be cached.
The following data from a mock WBEM server is cached:
its CIM repository
the content of the Python namespaces of its mock scripts (this includes for example the definition of any Python classes for the providers)
its registered providers
a list of dependent files registered by its mock scripts
The caches for the connection definitions are maintained in the
.pywbemcli_mockcache
directory in the user’s home directory.
If a connection is used, pywbemcli verifies whether its mock WBEM server has been cached, and if so, whether the cache is up to date. If it is not up to date, it is not used but re-generated.
For determining whether the cache is up to date, the file content of the MOF files and mock scripts of the connection definition, as well as any registered dependent files are used. The file dates are not used for this.
If a mock script uses further files that define the mock environment (e.g. when an XML or YAML file is used that defines an entire WBEM management profile), then pywbemcli does not know about these files. They can be made known to pywbemcli by registering them as dependent files. Once that is done, they are also used to determine whether the mock cache is up to date. See Registry for provider dependent files (in the pywbem documentation) for details on how to register dependent files.
Pywbemtools development¶
This section only needs to be read by developers of the pywbemtools package. People that want to make a fix or develop some extension, and people that want to test the project are also considered developers for the purpose of this section.
Generally development users will install pywbemtools by cloning the pywbemtools GitHub package and using the Make utility to handle the installation of pywbemtools and its prerequisites. This provides the user with all of the source of pywbemtools and in addition, the test environment and the documentation files.
Repository¶
The repository for pywbemtools is on GitHub:
Setting up the development environment¶
It is recommended to use Linux as the development environment for pywbemtools. OS-X should work as well, but Windows requires a number of manual setup steps.
Clone the Git repo of this project and switch to its working directory:
$ git clone git@github.com:pywbem/pywbemtools.git $ cd pywbemtools
It is recommended that you set up a virtual Python environment. Have the virtual Python environment active for all remaining steps.
Install pywbemtools and its prerequisites for installing and running it as described in Installation. This will install Python packages into the active Python environment, and OS-level packages.
Unix-like environments on Windows (such as CygWin, MinGW, Babun, or Gow) bring their own Python, so double check that the active Python environment is the one you want to use.
Install the prerequisites for pywbemtools development. This will install Python packages into the active Python environment, and OS-level packages:
$ make develop
This project uses Make to do things in the currently active Python environment. The command:
$ make
displays a list of valid Make targets and a short description of what each target does.
Building the documentation¶
The ReadTheDocs (RTD) site is used to publish the documentation for the pywbemtools package at https://pywbemtools.readthedocs.io/
This page is automatically updated whenever the Git repo for this package changes the branch from which this documentation is built.
In order to build the documentation locally from the Git work directory, execute:
$ make builddoc
The top-level document to open with a web browser will be
build_doc/html/docs/index.html
.
Testing¶
All of the following make commands run the tests in the currently active Python environment. Depending on how the pywbemtools package is installed in that Python environment, either the pywbemtools directory in the main repository directory is used, or the installed pywbemtools package. The test case files and any utility functions they use are always used from the tests directory in the main repository directory.
The tests directory has the following subdirectory structure:
tests
+-- unit Unit tests
| +-- utils Utility functions used by unit tests
+-- manual Manual tests
+-- schema The CIM schema MOF files used by some tests
There are multiple types of tests in pywbemtools:
Unit tests and function tests
Today, the unit tests and function tests are contained in the single directory unit.
The distinction between unit tests and function tests as used in pywbemtools is that function tests exercise the entire pywbemcli client component or entire scripts using the pywbem_mock module and mock CIM model definitions to emulate a WBEM server, while unit tests exercise single modules without using access to a WBEM server.
Generally, the function tests are organized by the command group so that for example the function tests for the class command group are in the file
test_class_subcmd.py
.Tests are run by executing:
$ make test
Test execution can be modified by a number of environment variables, as documented in the make help (execute
make help
).
Manual tests
There are several Python scripts and shell scripts that can be run manually. The results need to be validated manually.
These scripts are in the directory:
tests/manual/
and are executed by simply invoking them from within the main directory of the repository, e.g.:
tests/manual/test_pegasus.py
Some of the scripts support a
--help
option that informs about their usage.Some tests depend on the existence of a DMTF Schema defining the classes and qualifier declarations in a particular release
Running Tox
To run the unit and function tests in all supported Python environments, the Tox tool can be used. It creates the necessary virtual Python environments and executes
make test
(i.e. the unit and function tests) in each of them.For running Tox, it does not matter which Python environment is currently active, as long as the Python tox package is installed in it:
$ tox # Run tests on all supported Python versions $ tox -e py27 # Run tests on Python 2.7
Disabling the spinner when debugging¶
Subcommands normally display a spinner (a character-based spinning wheel) while waiting for completion.
For debugging, it is useful to disable that spinner. This can be done by
setting the PYWBEM_SPINNER
environment variable to ‘false’, ‘0’, or the
empty string. For example:
$ export PYWBEM_SPINNER=false
Contributing¶
Third party contributions to this project are welcome!
In order to contribute, create a Git pull request, considering this:
Test is required.
Each commit should only contain one “logical” change.
A “logical” change should be put into one commit, and not split over multiple commits.
Large new features should be split into stages.
The commit message should not only summarize what you have done, but explain why the change is useful.
The commit message must follow the format explained below.
What comprises a “logical” change is subject to sound judgement. Sometimes, it makes sense to produce a set of commits for a feature (even if not large). For example, a first commit may introduce a (presumably) compatible API change without exploitation of that feature. With only this commit applied, it should be demonstrable that everything is still working as before. The next commit may be the exploitation of the feature in other components.
For further discussion of good and bad practices regarding commits, see:
Core Development Team¶
Anyone can contribute to pywbemtools via pull requests as described in the previous section.
The pywbemtools project has a core development team that holds regular web conferences and that is using Slack for offline communication, on the Slack workspace: https://pywbem.slack.com.
The web conference and the Slack workspace are by invitation, and if you want to participate in the core team, please open a pywbem issue to let us know.
Appendix¶
This section contains information that is referenced from other sections, and that does not really need to be read in sequence.
Special terms¶
This documentation uses a few special terms to refer to Python types:
- CIM-XML¶
The name of the protocol that pywbemcli uses to communicate with WBEM servers. CIM-XML is defined in DSP0200.
- CIM object output formats¶
Pywbemcli output formats (specified with the --output-format general option) that format the resulting CIM objects or CIM object paths as MOF, CIM-XML, or using the pywbem repr or str formatting. See CIM object formats for details.
- Table output formats¶
Pywbemcli output formats (specified with the --output-format general option) that format the result as a table. See Table formats for details.
- Tree output format¶
A pywbemcli output format (specified with the --output-format general option) that formats the result as a tree using ASCII characters. See ASCII tree format for details.
- INSTANCENAME¶
A CIM instance path in a format that is suitable as a command line argument or option value of pywbemcli. Several commands of the instance command group use INSTANCENAME as a command line argument.
The supported formats for INSTANCENAME are an untyped WBEM URI and the use of wildcard keys i.e.
CLASSNAME.?
, as detailed in Specifying the INSTANCENAME command argument.Examples:
CIM_RegisteredProfile.InstanceID="acme:1" CIM_System.CreationClassName="ACME_System",Name="MySystem" CIM_System.?
- connection id¶
A string that uniquely identifies each
pywbem.WBEMConnection
object created. The connection id is immutable and is accessible aspywbem.WBEMConnection.conn_id
. It is included in each log record and may be used to relate pywbem log records to connections.- DeprecationWarning¶
A standard Python warning that indicates a deprecated functionality. See section Deprecation and compatibility policy and the standard Python module
warnings
for details.- CIM namespace¶
A CIM namespace (defined in DSP0004) provides a scope of uniqueness for CIM objects; specifically, the names of class objects and of qualifier type objects shall be unique in a namespace. The compound key of non-embedded instance objects shall also be unique across all non-embedded instances of the class (not including subclasses) within the namespace.
- connections file¶
A file maintained by pywbemcli and managed by the connection command group. The connections file defines a list of named WBEM connection definitions, each of which is either the set of parameters for connecting to a real WBEM server, or the set of files for creating a mock WBEM server. This allows connection definitions to be persisted and referenced by name in pywbemcli commands, via the --name general option.
By default, the connections file is
.pywbemcli_connections.yaml
in the user’s home directory. The user’s home directory depends on the operating system used. It is determined withos.path.expanduser("~")
, which works on all operating systems including Windows. Seeexpanduser()
for details. The default connections file can be changed using thePYWBEMCLI_CONNECTIONS_FILE
environment variable, or with the --connections-file general option.- MOF¶
MOF (Managed Object Format) is the language used by the DMTF to describe in textual form CIM objects including CIM classes, CIM instances, etc. It is one of the output formats provided for the display of CIM objects in pywbemcli. See DMTF DSP0004 for more information on the MOF format.
- WBEM management profile¶
- management profile¶
WBEM management profiles define specific management functionality in terms of the CIM model and WBEM operations. The DMTF publishes management profiles in several areas and the SNIA within the SMI-S specification.
Management profiles are identified by organization, name and version. WBEM servers advertise the management profiles that are implemented by the server so that they can be discovered by WBEM clients to determine the management capabilities of the WBEM server. This includes providing the clients a programmatic access to the central instances of the management profile. For details, see Profile advertisement methodologies.
- central instances¶
The CIM instances that act as an algorithmic focal point for accessing the management functionality provided by the implementation of a management profile on a WBEM server. The central instances typically represent the central managed resource in the management domain that is addressed by the management profile.
- WBEM URI¶
WBEM URI is a standardized text form for CIM object paths and is defined in DSP0207. Pywbemcli uses the untyped WBEM URI format for instance names in the command line (i.e. INSTANCENAME).
- REPL¶
Stands for “Read-Execute-Print-Loop” which is a term that denotes the pywbemcli shell interactive mode where multiple command groups and commands may be executed within the context of a connection defined by a set of general options.
- Unix-style path name pattern¶
A pattern used in Unix environments for path names (file names and directory names). It is used by pywbemcli for example to expand class names in the
class find
command. No tilde expansion is done, but*
,?
, and character ranges expressed with[]
are supported. Example:CIM_*Device*
.- source end role¶
The reference in an association class that is on the source side when performing an association traversal. The source side is where the traversal begins.
- far end role¶
The reference in an association class that is on the far side when performing an association traversal. The far side is where the traversal ends.
- traditional operations¶
The CIM-XML operations originally defined by the DMTF in (DSP0200) for requesting multiple instances from a WBEM server are
EnumerateInstances
,EnumerateInstanceNames
,Referencess
,ReferenceNames
,Associators
,AssociatorNames
, andExecQuery
. These are monolithic operations and expect the WBEM server to prepare complete responses before returning any results. Because the response must be either contain all of the requested instances or an error response they causes issues with very large reponses. In later versions of (DSP0200), an alternative to the above operations named pull operations were added to improve memory and response efficiency.- backslash-escaped¶
The UNIX-like shells interpret single and double quotes in a certain way and remove them before passing the arguments on to the program invoked. Because the single and double quotes in INSTANCENAME need to be passed on to pywbemcli, they need to be protected from removal by the shell. This can be achieved by putting INSTANCENAME into single quotes if it only includes double quotes, or into double quotes if it only includes single quotes. If there is a mix of single and double quotes in INSTANCENAME, or if shell variables need to be expanded, this can be achieved by backslash-escaping any double quotes in INSTANCENAME, and putting it into double quotes.
- default connection¶
A connection definition in the connections file that is used by pywbemcli as the current connection if pywbemcli is started without any connection definition (no --server general option, --mock-server general option, or --name general option) and the default connection is defined. A connection definition in the connections file becomes the default connection on pywbemcli startup if it is specified using the connection select command and the
--default
/-d
command option is used.- current connection¶
The connection definition in pywbemcli that is currently active; it is the target connection for pywbemcli commands. The current connection is created on pywbemcli startup with the following options --server general option, --mock-server general option, or --name general option or if a default connection) has been defined. The current connection can be changed in the interactive mode with the connection select command.
- CQL¶
CQL (CIM Query Language) is a query language defined by DMTF for use by query operations against WBEM servers. In operation parameters that define the use of a query language, it is specified with the string
DMTF:QCL
. CQL is described in DMTF standard DSP0202.
Profile advertisement methodologies¶
This section briefly explains the profile advertisement methodologies defined by DMTF. A full description can be found in DSP1033.
These methodologies describe how a client can discover the central instances of a management profile. Discovering the central instances through a management profile is the recommended approach for clients, over simply enumerating a CIM class of choice. The reason is that this approach enables clients to work seamlessly with different server implementations, even when they have implemented a different set of management profiles.
The DMTF defines three profile advertisement methodologies in DSP1033:
GetCentralInstances methodology (new in DSP1033 1.1)
Central class methodology
Scoping class methodology
At this point, the GetCentralInstances methodology has not widely been implemented, but pywbem supports it nevertheless.
All three profile advertisement methodologies start from the CIM_RegisteredProfile instance that identifies the management profile, by means of registered organization, registered name, and registered version.
It is important to understand that the CIM_RegisteredProfile instance not only identifies the management profile, but represents a particular use of the management profile within its scoping profiles. For an autonomous profile, there are no scoping profiles, so in that case, there is only one use of the autonomous profile in a server. However, component profiles do have scoping profiles, and it is well possible that a component profile is used multiple times in a server, in different scoping contexts. If that is the case, and if discovery of central instances using any of the profile advertisement methodologies is supposed to work, then each such use of the profile needs to have its own separate CIM_RegisteredProfile instance, because each such use of the profile will also have its own separate set of central instances.
Unfortunately, neither the DMTF standards nor the SMI-S standards are clear about that requirement, and so there are plenty of implementations that share a single CIM_RegisteredProfile instance identifying a particular component profile, for multiple distinct uses of the profile by its scoping profiles. In such a case, the profile advertisement methodologies will not be able to distinguish the distinct sets of central instances alone, and other means need to be used to distinguish them.
It is also important to understand that the choice which profile advertisement methodology to implement, is done by the WBEM server side. Therefore, a WBEM client such as pywbem needs to support all methodologies and needs to try them one by one until one succeeds. Pywbem tries the three methodologies in the order listed above.
In the GetCentralInstances methodology, the CIM_RegisteredProfile instance has a CIM method named GetCentralInstances that returns the instance paths of the central instances of the use of the profile.
In the central class methodology, the CIM_RegisteredProfile instance is associated directly with the set of central instances of the use of the profile, via a CIM_ElementConformsToProfile association.
In the scoping class methodology, the CIM_RegisteredProfile instance is not associated directly with the set of central instances of the use of the profile, but delegates that to its scoping profile. The client navigates up to the CIM_RegisteredProfile instance representing the (use of the) scoping profile, looks up its central instances, and from each of those, navigates down along the reversed scoping path to the central instances of the profile in question. The scoping path of a component profile describes the traversal across associations and ordinary classes from the central class to the scoping class of the profile. This profile advertisement methodology is obviously the most complex one of the three.
Pywbem encapsulates the complexity and choice of these methodologies into
a single invocation of an easy-to use method
pywbem.WBEMServer.get_central_instances()
.
Profile implementations in a WBEM server are not entirely free when making a choice of which methodology to implement:
Autonomous profiles in a WBEM server must implement the central-class methodology, and may in addition implement the GetCentralInstances methodology.
Note that the scoping class methodology falls together with the central class methodology for autonomous profiles, because their scoping class is also their central class.
Component profiles in a WBEM server may implement the central class methodology and the GetCentralInstances methodology, and must support the scoping class methodology.
Note that implementing the scoping class methodology in a WBEM server requires implementing the classes and associations of the scoping path, which are usually mandatory anyway. So while the scoping class methodology is more complex to use for clients than the central class methodology, it is easier to implement for servers.
Use of the scoping class methodology by a client requires knowing the central class, scoping class and scoping path defined by the component profile.
DSP1001 requires that conformant autonomous profiles specify a central class, and that conformant component profiles specify a central class, scoping class and a scoping path.
Older DMTF component profiles and older SNIA subprofiles do not always specify
scoping class and scoping path. In such cases, the scoping class and scoping
path can often be determined from the class diagram in the specification for
the profile.
Many times, CIM_System
or CIM_ComputerSystem
is the scoping class.
References¶
- DSP0004¶
- DSP0200¶
- DSP0201¶
- DSP0202¶
- DSP0207¶
- DSP0212¶
- DSP1001¶
DMTF DSP1001, Management Profile Specification Usage Guide, Version 1.1
- DSP1033¶
- RFC3986¶
IETF RFC3986, Uniform Resource Identifier (URI): Generic Syntax, January 2005
- RFC6874¶
- WBEM Standards¶
- SMI-S¶
- Python Glossary¶
- pywbem¶
A WBEM client and WBEM listener written in Python. See pywbem GitHub repository and the pywbem package on Pypi.
Change log¶
pywbemtools 0.9.1¶
Released: 2022-01-03
Bug fixes:
Fixes issue where the command:
class invokemethod <class> <method> -n <namespace>
ignores the command namespace option (-n) and usedsthe default namespace. (see issue #990)Fix issue where an exception occurs if the user tries to display cim instances as a table but the class for the instances returned are not in the default namespace and an alternate namespace is defined for the command. The function display_cim_objects(…) uses valuemapping_for_property() but specifies the default namespace as the target. (See issue #995)
Fixed issues raised by new Pylint versions 2.9 and 2.10.
Fixed an error that resulted in exception traceback when instance commands used the instance wildcard (e.g. ‘CIM_ManagedSystemElement.?’) and the enumerate instances operation failed for some reason. (issue #963)
Disabled new Pylint issue ‘consider-using-f-string’, since f-strings were introduced only in Python 3.6.
Fixed install error of wrapt 1.13.0 on Python 2.7 on Windows due to lack of MS Visual C++ 9.0 on GitHub Actions, by pinning it to <1.13.
Fixed issue with Sphinx and python 2.7 by changing the sphinx requirements in dev-requirements.txt and minimum-constraints.txt. (see issue #1070)
Modify dev-requirements.txt to limit version of more-itertools to < 8.10.1 for python < 3.6. (see issue #1077)
Fixed new issues raised by pylint 2.12.2.
Enhancements:
Enhanced test matrix for push-driven runs on GitHub Actions to add Python 3.5 on macOS, and removing Python 3.4 minimum on Windows.
Cleanup:
Add list of security issues to be ignored by Makefile security test and enable failure of build if security test fails. This brings Pywbemtools into line with pywbem Makefile.Reordered some of the items in the minumum_constraints.txt file to better compare with the pywbem file and also commented out all minimum constraints for Jupyter and its dependencies since we have no notebooks in pywbemcli today. Modified minimum version of typed-ast, pylint and astrid to match pywbem and pass saftey tests.
pywbemtools 0.9.0¶
This version contains all fixes up to pywbemtools 0.8.1.
Released: 2021-05-03
Incompatible changes:
Modified the –timestats general option from boolean to choice with 3 choices for when statistics are displayed (after each command or via a command). See issue #588)
Deprecations:
Deprecated the ‘server namespaces’ and ‘server interop’ commands. Use the new commands ‘namespace list’ and ‘namespace interop’, respectively. (issue #877)
The ‘–force’ / ‘-f’ option of the ‘class delete’ command has been deprecated because its name does not sufficiently make it clear that other inhibitors than existing instances of the class (such as existing subclasses, or referencing classes) will still cause rejection of the command. Use the new ‘–include-instances’ option instead. (issue #885)
Bug fixes:
Fixed a ValueError on Windows that was raised when the connections file was not on the home drive.
Limit click package to < 8.0 because of a) incompatibility with python 2.7, b) incompatibility between click 8.0 and clicl-repl. (see issues #816 and #817)
Limit mock package to lt 4.0.3 to avoid issue issue that causes test failure. (see #822)
Fix issue caused by mock package version 4.0.3 by creating replacements for warnings.warn and warnings.warn_explicit functions and removing the use of the patch decorator in pywbemcli.py before the definition of the cli function. (see issue #822)
Fixes issue where in pywbemcli the –timeout and –use-pull general options were not always correctly included in the new object context in interactive mode if they were specified on the interactive mode cmd line.
Fixed issue in tests with use of stdin and inputting the instance path for instance get and instance delete. This was a test setup issue and not a code issue. (see issue # 387)
Mitigated the coveralls HTTP status 422 by pinning coveralls-python to <3.0.0.
Fix issue where documentation index disappeared when we changed the documentation theme (see issue #868)
Test: Fixed behavior of ‘pdb’ test condition, which is supposed to stop in the pdb debugger before executing the command function, but did immediately leave the debugger again because of redirections of the standard streams. The debugger now properly comes up when ‘pdb’ is specified as a condition.
Test: Fixed restoring of environment variables that are modified by testcases, and displaying of PYWBEMCLI environment variables during testing in verbose mode.
Change MOFCompiler.add_mof/remove_mof() to only display exceptions received if not MOFCompileError since the MOF compiler logs all MOFCompileError exceptions. (see issue #395)
Enhancements:
Increased the minimum pywbem version to 1.2.0.
Add new option to class find command (–summary) to display a summary of the counts of classes found instead of the full list of the classes to make the command more useful for real servers that may return many classes for a class find. (see issue #810)
Extend the class tree command to optionally provide extra information about each class in the tree including 1) the value of the Version qualifier if it exists and whether the class is Abstract, an Association, or an Indication class. (see. # 817)
Migrated from Travis and Appveyor to GitHub Actions. This required several changes in package dependencies for development.
The verbose option (‘-v’ / ‘–verbose’) now also displays the objects that are compiled into a mock environment when setting it up.
Added ‘qualifier delete’ command. (see #884)
Enabled the tests for Python 3.4 on Windows again - this required some changes in the Makefile and constraints files.
Added a ‘namespace’ command group that allows listing, creating and deleting CIM namespaces, and showing the Interop namespace. The ‘server namespaces’ and ‘server interop’ commands that provide a subset of that functionality have been deprecated. (issue #877)
Added commands ‘add-mof’ and ‘remove-mof’ for compiling MOF to the ‘server’ command group. (issue #886)
Test: Added end2end test capability using the OpenPegasus container image on Docker Hub.
Added new command group (‘statistics’) that contols use of statistics. See issue #588)
Implement command to get statistics from server and present as a table #895)
Test: Added a unit test module for _utils.py.
Added an ‘–include-instances’ option to the ‘class delete’ command that replaces the deprecated ‘–force’ / ‘-f’ option. (issue #885)
Added an ‘–include-objects’ option to the ‘namespace delete’ command that causes the deletion of instances, classes and qualifier types in the targeted namespace before the namespace itself is deleted. The objects in the namespace are deleted in the correct order of dependencies so that no dangling dependencies exist at any point in the operation. (issue #885)
Added a ‘’–dry-run’ option to the ‘class delete’ and ‘namespace delete’ commands. If used, it displays the message about each deletion with a ‘Dry run:’ prefix and does not perform the actual deletion. (issue #911)
Cleanup:
Cleaned up the circumvention for Click issue #1231 by upgrading the minimum Click version to 7.1.1, where possible. The circumvention is still required on Python 2.7 and 3.4 on Windows.
Clarified in the help text of general option ‘–pdb’ that it will be ignored in interactive mode but can be specified on each interactive command.
Test: Added a check that rejects the use of the ‘pdb’ test condition when the test specifies stdin for the test, because the ‘pdb’ test condition disables the stdin/stdout/stderr redirection.
pywbemtools 0.8.0¶
This version contains all fixes up to pywbemtools 0.7.3.
Released: 2020-10-13
Incompatible changes:
Moving the commands “server profiles” and “serve centralinsts” to the new group profiles with the commmand names “profile list” and “profile centralinsts” added a command group and removed 2 commands from the server command group. (See issue #612)
The –deprecation-warnings / –no-deprecation-warnings general option has been remamed to –warn / –no-warn, and it now controls the display of all Python warnings.
Bug fixes:
Order display of instance names when the .? is used to pick an instance name so the same order of instance names is displayed for all versions of Python. (See issue #458 and #459)
Pinned prompt-toolkit to <3.0 on Python 3.8 on Windows to avoid WinError 995. (See issue #690)
Fixed exception when command entered in interactive mode, on Python 2. (See issue #224)
Test: Default connection file does not get restored in some cases during test. (See issue #680)
AssociationShrub produces instancename slightly different table output in some cases for pywbem 1 vs previous versions(inclusion of “/:” prefix). (see issue #704)
Test: Fixed attempt in test_class_cmds.py to invoke a non-static method on a class object. (see issue #707)
Fix help message for “–deprecated” to be unicode so python 2.7 help does not fail. (see issue #725). This error was added with issue #678
Upgraded nocasedict and nocaselist packages to pick up fixes.
Error in test defintion for qualdecl Indication causes failure with pywbem i.1.0 where mocker validates qualifiers scopes. (see issue #766)
Test: Preventive fix for potential issue with virtualenv raising AttributeError during installtest on Python 3.4. (see issue #775)
Test: Added checking for no expected warning. (see issue #774)
Fixed incorrect property order in instance table output, where key properties were not ordered before non-key properties but ordered along with them. (see issue #782)
Docs/Test: Fixed failing install of Jinja2 on Python 3.4 by adding it to dev-requirements.txt and pinning it to <2.11 for Python 3.4.
Test: Aligned qualifier definitions in test MOF with CIM Schema. (related to issue #788)
Upgraded pywbem to 1.1.1 to pick up fixes and enhancements. (see issues #749, #183)
Enhancements:
Introduced caching of the mock environment used by connection definitions in order to speed up the loading of the connection definition. The mock environments are stored in directory ~/.pywbemcli_mockcache and are automatically managed. The pywbemcli –verbose general option can be used to show messages about the cache management. (See issue #689)
A new approach for the setup of mock scripts has been introduced: The mock script defines a setup(conn, server, verbose) function that is called when the mock environment is built. It is not called when the mock environment is reinstantiated from the cache. The old approach with setting global variables CONN, SERVER, VERBOSE is still supported, but the mock environment cannot be cached and will be built every time when mock scripts with that setup approach are used. On Python <3.5, mock scripts with the setup() function are rejected, because the functionality to import them is not available, and the compile+exec approach does not allow executing the setup() function. (See issue #689)
Modify general help to display the full path of the default connections file. (See issue #660)
Move the commands associated with WBEM management profiles from the server group to a new profile group. (See issue #612). See also Incompatible changes.
Add –deprecated/-no-deprecated as a new qualifier filter for the class enumerate, class find, and instance count commands. Extend the behavior so that for each of the possible filters it looks for the qualifier on all of the elements (property, method, parameter) in addition to the class itself. See issue #678)
Test: Enabled coveralls to run on all Python versions in the Travis CI, resulting in a combined coverage for all Python versions.
For instance display in table format, added the display of the units of properties to the table headers. If a property in the class has a PUnit or Units qualifier set, the unit is translated to a human readable SI unit using the pywbem.siunit_obj() function, and appended to the property name in square brackets. (See issue #727)
Consolidated the warnings control, such that the deprecation messages were changed to be issued as Python warnings, and the –warn / –no-warn general options now control the display of all Python warnings. If –warn is used, all Python warnings are shown once. If –no-warn is used (default), the PYTHONWARNINGS environment variable determines which warnings are shown. If that variable is not set, no warnings are shown. (See issue #723) Added the ‘mock’ package and for Python 2.7, the ‘funcsigs’ package as new dependencies.
Specifying a property list (–pl option) on instance commands with table output formats now uses the order of properties as specified in the property list in the output table, instead of sorting them. (See issue #702)
Allow unsetting general options. Originally the general options could be either set specifically by defining them on the command line or the default would be enabled. However, in interactive mode the need may arise to set an option back to its default value (i.e. the equivalent of not including it on the command line). This fixes the options so that there is an alternative that will will set them to the default value. (see issue #350)
Converted remaining unittest testcases to pytest. (See issue #91)
Test: When testing with latest package levels, the package versions of indirect dependencies are now also upgraded to the latest compatible version from Pypi. (see issue #784)
Cleanup
Remove unused NocaseList from __common.py
Moved the general option –pull_max_cnt to become part of the persistent server definition rather than transient. This means that this parameter is part of the data maintained in the server definitionfile and applies to just the server defined. (See issue #694)
Docs: Improved the description and help texts of the connections file and the –connections-file general option in various places, for consistency. (Related to issue #708)
Move code associated with display_cimobjects() to a separate module. This is part of creating table representation of classes (See issue #249)
Resolved remaining Pylint issues and enforced clean pylint checks. (See issue #668)
Renamed the default connections file in the user’s home directory from pywbemcli_connection_definitions.yaml to .pywbemcli_connections.yaml, because it is really an internal file not meant for being edited. An existing file with the old name is migrated automatically. (See issue #716)
Refactor error handling for connections file handlingif there are problems with the YAML file or loading the file. Created new exceptions for the Connections File and created a unit test and function error test. (see issue #661)
Separate code to execute test files (ex. setup up mock of prompt) from the process of executing files defined by the –mock-server general option. The new capability is controled by an environment variable “PYWBEMCLI_STARTUP_SCRIPT” that is considered intenal to pywbemcli testing.
Refactor statistics display to present information consistent with the display in pywbem. (see issue # 724)
Refactor connections show command and clean up its documentation. (see issue #732)
Remove use of pydicti dictionary package in favor of NocaseDict.
set pylint disable on all uses of pdb.set_trace(). This is an issue between the add-on package pdbpp and lint, not pdb. (see issue # 751)
Docs: Changed Sphinx theme to sphinx_rtd_theme. (see issue #792)
Modified the class WbemServerMock in tests/unit/testmock to define a WBEM server configuration that includes multiple namespaces, a user and an interop namespace to test cross-namespace mock. (see issue #183)
pywbemtools 0.7.0¶
This version contains all fixes up to pywbemtools 0.6.1.
Released: 2020-07-12
Incompatible changes:
The default location for the connections file (pywbemcli_connection_definitions.yaml) has been moved from the users current directory to the users home directory. A general option (
connections_file
) allows the user to set other directories and file names for this file. (See issue #596)
Deprecations:
Deprecated support for Python 2.7 and 3.4, because these Python versions have reached their end of life. A future version of pywbemtools will remove support for Python 2.7 and 3.4. (see issue #630).
Bug fixes:
Fixed incorrect connection list output in readme files (see issue #593).
Fixed yaml.RepresenterError during ‘connection save’ command. This introduced a dependency on the yamlloader package. (see issue #603).
Fixed possible issue where the connection test command would fail on a server that did not support class operations. (See issue #606)
Pinned version of colorama to <0.4.0 for Python <=3.4.
Adjusted to changes in the pywbem mock support for method providers, in the sample method provider simple_mock_invokemethod_pywbem_V1.py. (See issue #646)
Fix issue with MOF compile in pywbem_mock to account for changes to pywbem.FakedWBEMConnection in pywbem 1.0.0. Because the pywbem mocker stopped displaying compile error messages, this change modifies the code to display the compile errors as exceptions for pywbem 1.0 and use the original display for pre 1.0 pywbem version. With pywbem 1.0.0 it also outputs the compile error message and exception to stderr whereas before the compile error text was routed to stdout. (See issue #637)
Fixed an issue where displaying instances in a table format missed properties if the list of instances had different sets of properties. (See issue #650)
Change the table output for outputformat html to output the title parameter as an html caption entity instead of as a paragraph. This allows html tables to be subtabled and also presents the table title better. (see issue #721)
Enhancements:
Enabled installation using ‘setup.py install’ from unpacked source distribution archive, and added install tests for various installation methods including this one. (see issues #590, #591).
Enhance output formats to allow an additional format group TEXT with a single format
text
. This format outputs the command result as a text string to the console and is use for simple commands likeserver interop
that only output one piece of data. (see issue #594)Extended the command connection test so that it will also test for existence of the DMTF pull operations. It tests for all of the operations and reports success or failure on each operation.
Added value-mapped strings to properties in instance table output. For integer-typed (scalar or array) properties that have a ValueMap qualifier, the output of instances in table format now includes the value of the Values qualifier in parenthesis, in addition to the integer value. (See issue #634)
The order of properties when displaying instances in a table format is now predictable: First the sorted key properties, then the sorted non-key properties. (Part of fix for issue #650)
Modify connections file location functionality so that the default file location is the users home directory. Any other directory and filename can be specified using the general option
connections_file
which has a corresponding environment variable. (See issue #596)
Cleanup
Adds command to test connection for existence of the pull operations (connection test-pull)
Refactored display_class_tree() and other functions in _displaytree.py and _cmd_class.py cmd_class_tree function to eliminate boundary conditions, and clarify code.
Extended parameter type testing in class PywbemServer so that all constructor parameters are value tested. This specifically fixes issue where we were depending on WBEMConnection to test types of ca_certs and invalid data types could get into the connections file. (See issue #663).
Added a function test test module test_misc_errors.py that tests for some common exceptions that apply to many commands (ex. connection error).
pywbemtools 0.6.0¶
This version contains all fixes up to pywbemtools 0.5.1.
Released: 2020-04-10
Bug fixes:
Fix issue with mixed old and new formats on click.echo statement. (See issue #419)
Fixed missing Python 3.7 in supported environments shown on Pypi. (See issue #416)
Fixed that the ‘class find’ command showed the –namespace option twice (see issue #417)
Added PyYAML>=5.1 as a prerequisite package for pywbemtools for installation. So far, it was pulled in indirectly via pywbem.
Fixed case sensitive matching of class names in instance modify by picking up the fix in pywbem 0.14.6. (See issue #429).
Fixed issue where extra diagnostic information about click was being displayed when the general option –verbose was defined.
Fixed issue with x509 parameter of WBEMConnection. (See issue #468)
Fixed issue with class find command not returning connection error when cannot connect to server.
Added documentation for the –version general option.
Increased pywbem minimum version to 0.16.0 to accomodate install issues on Python 3.4, and to pick up other fixes.
Test: Accomodated new formatting of error messages in Click 7.1.1, and excluded Click 7.1 due to bug.
Test: Fixed dependency to Python development packages on CygWin platform in Appveyor CI.
Pygments 2.4.0 and readme-renderer 25.0 have removed support for Python 3.4 and have therefore been pinned to below these versions on Python 3.4.
Fix bug where order of commands listed in help output was different for different versions of Python. (See issue #510)
Increased minimum version of pluggy package from 0.12.0 to 0.13.0 because it failed during loading of pytest plugins on Python 3.8. (See issue #494)
Test: Changed testcases that check the CIM-XML generated with output format ‘xml’ to tolerate the different order of XML attributes that happens on Python 3.8 (See issue #494)
Fixed several badges on the README page.
Remove use of pywbem internal functions from pywbemcli. This removes use of NocaseDict, _to_unicode, _ensure_unicode, _format from pywbemcli. (See issue #489)
Corrected issue with use-pull general option that causes issues with using the ‘either’ option with servers that do not have pull. (See issue #530)
Pinned dparse to <0.5.0 on Python 2.7 due to an issue.
Test: Fixed incorrect coverage reported at the end of the pytest run, by increasing the minimum version of the coverage package to 4.5.2. (See issue #547)
Test: Fixed bug with detection of invalid test validation values, and fixed testcases in turn (See issue #553).
Fixed issues in README and README_PYPI file (See issue #555)
Improvements and bug fixes in the way the INSTANCENAME parameter of pywbemcli commands is processed. (See issue #528)
Increased minimum versions of some packages used for development to address security issues reported by the pyup.io safety tool: twine, bleach, urllib3.
Enhancements:
Promoted development status of pywbemtools from Alpha to Beta. (See issue #476)
Add capability to reorder commands in the help for each group. The commands in all groups except for the top group (pywbemcli -h) are ordered in the help list by their order in their source file. The display of commands in the top level group is alphabetical except that connection, help, and repl are reordered to the bottom of the list. (See issue #466)
Define alternatives for creating INSTANCENAME input parameter since the original form using, WBEMURI is error prone with quote marks. (see issue #390)
Add prompt-toolkit auto-suggest. This extends the command completion capability in the repl mode (interactive mode) to make suggestions on command line input based on the history file. Usually auto-suggest completion will be shown as gray text behind the current input. Auto-suggest is not available in command line mode.
Add ability to filter results of ‘class enumerate’, ‘class find’, and ‘instance count’ commands for selected class qualifiers. This ability is based on 3 new options for each of the above commands ‘–association’, ‘–indication’, and ‘–experimental’ each of which has a corresponding ‘no-…’. The user can filter to find classes with combinations of these options returning only classes that meet the option criteria. Thus, ‘–association’ returns classes that are associations and ‘–no-association’ returns only classes that are not associations. See issue #447
Added support for disabling the spinner that is displayed by default during any ongoing activities, by setting the env var PYWBEM_SPINNER to ‘false’, ‘0’, or the empty string. This is useful when debugging. See issue #465.
Modified the response handling on commands that may return nothing with successful response to display a message if the general option –verbose is defined and display nothing if –verbose not set. This includes class/instance delete, instance modify and the commands that display cim objects. (See issue #123)
Changed the –ca-certs general option to support the changes as of pywbem version 1.0.0 (new values ‘system’ and ‘certifi’, and default changed from a fixed set of directories to ‘certifi’). The pywbem version is determined at run time and pywbem versions before 1.0.0 are still supported.
Test: Improved assertion messages in tests.
Output of “pywbemcli server profiles” command is now reliably sorted by version in addition to org and name. (See issue #500)
Added support for a new –pdb general option and corresponding PYWBEMCLI_PDB environment variable that causes the pywbemcli command to come up with the pdb debugger before invoking the specified command. This is a debug feature that is expected to be used mainly by the developers of pywbemcli. (See issue #505)
Test: Added support for entering the pdb debugger from specific unit testcases by setting the condition parameter of the testcase to the string ‘pdb’. This causes pywbemcli to be invoked with the new –pdb option for that testcase. (See issue #505)
Removed usage of the “pbr” package. It was used for automatic versioning of the pywbemtools package, but it had too many drawbacks for that small benefit (See issue #178):
Getting the minor version increased in a development version (instead of the patch version) by means of markers in the commit message never worked.
The package needed to be tagged twice during the release process.
If the last tag was too far in the past of the commit history, the shallow git checkout used by Travis failed and its depth needed to be adjusted. At some point this defeats the purpose of a shallow checkout.
Test: Added support for testing on Python 3.8 in Travis, Appveyor and Tox. (See issue #494)
Added support for adjusting the width of any help output to the terminal width. The width can be set using the PYWBEMCLI_TERMWIDTH env var. (See issues #518 and #542)
Docs: Increased the width of the help text to 120 (See issue #548).
Modified the help usage to better reflect the required and optional components of the command line. This includes showing the location in the cmd line for general options where before it was called [COMMAND-OPTIONS] and showing the positioning of both arguments and command arguments. (See issue #446)
Increased minimum version of pywbem to 0.17.0 (See issue #571)
Add option –full to connection list to create both a brief table output that only has 3 columns (name, server, mock-server) as default but when the option is set all of the columns currently in the report. We did this because it appears that the most frequent use of this command is to just get the name of the various servers defined within an 80 column display. This also now shows empty columns where the original report hid any columns that were empty. (See issue #556)
Cleanup:
Test: Enabled Python warning suppression for PendingDeprecationWarning and ResourceWarning (py3 only), and fixed incorrect make variable for that.
Test: Removed testfixtures from minimum constraints file, as it is not used.
Test: Increased minimum version of pytest from 3.3.0 to 4.3.1 because it fixed an issue that surfaced with pywbem minimum package levels on Python 3.7.
Code: refactor code to use only the .format formatter and remove all use of the % formatter.
Test: Added missing indirectly referenced prerequisite packages to minimum-constraints.txt, for a defined package level when testing with PACKAGE_LEVEL=minimum.
Clean up test mock files by merging mock_simple_model_ext.mof into mock_simple_model.mof
Changed some tests to account for behavior difference with pywbem 0.15.0 references and associations with invalid class, role.
Changed minimun version of pywbem to 0.15.0 because of test differences that resulted from differences between pywbem 0.14.6 and 0.15.0. The differences are in pywbem_mock where the code was changed to return errors for invalid classnames and roles in association and reference operations where it previously return empty, ignoring the invalid classname.
Added tests of all command groups and commands for server connection error.
Removed a circumvention for a pywbem bug related to colons in WBEM URIs that was fixed in pywbem 0.13.0. (See issue #131)
Added the general option –use-pull to the the PywbemServer() class so that it is persisted in the connection file and to the display of connection information (connection show and connection list). This means that –use-pull can now be set for a particular server permanently.(See issues #529 and #534).
Added table formatted output for connection show and removed original free-form output format. (See issue #572)
Added documentation on incremental search option to search the command history file in interactive mode. (See issue #595)
Added documentation index entries for commands, command groups, etc. (see issue #598)
pywbemtools 0.5.0¶
Released: 2019-09-29
This is the initial release of pywbemtools.