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
py: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
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.7.3 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:
- CIM namespaces
- 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.
- <group name> <command name> for commands that are defined within
groups (ex.
- 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.
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 --deprecation-warnings general option controls the display of deprecation 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
general option is a boolean option that enables the
gathering and display of time
statistics on the interactions with the WBEM server. If enabled, the
time statistics are output after each command is executed including the
operations executed, the size of the operations, and the execution time.
--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 file path for the connections file. It is the file path of a YAML file
that defines server configurations by name. The default if this option is
not specified is to use the connections file
pywbemcli_connection_definitions.yaml
in the users home directory.
The users home directory is OS dependent. The connection file name is
displayed in the connections list
command
When this option is set, the YAML file defined with the option is used as the connections file.
In the interactive mode, this option may not be modified after the command line is processed.
The connections_file is managed with the commands in the connection command group
--deprecation-warnings
general option¶
The --deprecation-warnings
/--no-deprecation-warnings
general option is
a boolean option that controls the display of deprecation warnings on the
standard error stream.
By default, the display of deprecation warnings is enabled.
--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 | --server |
PYWBEMCLI_NAME | --name |
PYWBEMCLI_USER | --user |
PYWBEMCLI_PASSWORD | --password |
PYWBEMCLI_OUTPUT_FORMAT | --output-format |
PYWBEMCLI_DEFAULT_NAMESPACE | --default-namespace |
PYWBEMCLI_TIMEOUT | --timeout |
PYWBEMCLI_KEYFILE | --keyfile |
PYWBEMCLI_CERTFILE | --certfile |
PYWBEMCLI_CA_CERTS | --ca-certs |
PYWBEMCLI_USE_PULL | --use-pull |
PYWBEMCLI_PULL_MAX_CNT | --pull-max-cnt |
PYWBEMCLI_STATS_ENABLED | --timestats |
PYWBEMCLI_MOCK_SERVER (1) | --mock-server |
PYWBEMCLI_LOG | --log |
PYWBEMCLI_PDB | --pdb |
PYWBEMCLI_DEPRECATION_WARNINGS | --deprecation-warnings |
PYWBEMCLI_CONNECTIONS_FILE | --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_connection_definitions.yaml
in
the current 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 either or yes |
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.
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 --association
/--no-association
, --indication
/--no-indication
,
and --experimental
/--no-experimental
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.
The following example enumerates the class names of the root classes in the default namespace:
$ pywbemcli --name mymock class enumerate --names-only
TST_Person
TST_Lineage
TST_MemberOfFamilyCollection
TST_FamilyCollection
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 --association
/--no-association
, --indication
/--no-indication
,
and --experimental
/--no-experimental
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.
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
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
,
and --experimental
/--no-experimental
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 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 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.
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 centralinsts command - List central instances of mgmt profiles on 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 profiles command - List management profiles advertized by 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 Table output formats.
Example:
$ pywbemcli --name myserver --output-format plain server namespaces
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 profiles
command¶
The server profiles
command lists the
management profiles advertised by the
WBEM server of the current connection.
The returned management profiles are displayed with organization, name, and 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 name,
respectively.
Example:
$ pywbemcli --name myserver --output-format simple server profiles
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 server profiles –help for the exact help output of the command.
server centralinsts
command¶
The server 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 server 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 server centralinsts –help for the exact help output of the command.
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: ./pywbemcli_connection_definitions.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. 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. Default: EnvVar PYWBEMCLI_USER, or none.
-p, --password TEXT Password for the WBEM server. Default: EnvVar PYWBEMCLI_PASSWORD, or prompted for if
--user specified.
--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. 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. 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 Show time statistics of WBEM server operations.
-d, --default-namespace NAMESPACE
Default namespace, to be used when commands do not specify the --namespace command
option. 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. 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], default: file; DETAIL:
[all|paths|summary], default: all. Default: EnvVar PYWBEMCLI_LOG, or all.
-v, --verbose / --no-verbose Display extra information about the processing.
--deprecation-warnings / --no-deprecation-warnings
Enable deprecation warnings. Default: EnvVar PYWBEMCLI_DEPRECATION_WARNINGS, or true.
-C, --connections-file FILE PATH
File path of a YAML file containing named connection definitions. The default if this
option is not specified is the file name "pywbemcli_connection_definitions.yaml" in
the users home directory. EnvVar (PYWBEMCLI_CONNECTIONS_FILE)
--pdb Pause execution in the built-in pdb debugger just before executing the command within
pywbemcli. 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.
qualifier Command group for CIM qualifier declarations.
server Command group for WBEM servers.
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 subclasses, the command is rejected.
If the class has instances, the command is rejected, unless the --force 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 -n myconn class delete CIM_Foo -n interop
Command Options:
-f, --force Delete any instances of the class as well. Some servers may still reject the class
deletion. Default: Reject command if the class has any instances.
-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
-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
-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.
In the output, the classes will formatted as a ASCII graphical tree; the --output-format general option is ignored.
Examples:
pywbemcli -n myconn class tree -n interop
pywbemcli -n myconn class tree CIM_Foo -n interop
pywbemcli -n myconn class tree CIM_Foo -s -n interop
Command Options:
-s, --superclasses Show the superclass hierarchy. Default: Show the subclass hierarchy.
-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
connection definitions are stored in a connections file named 'pywbemcli_connection_definitions.yaml' in the current
directory. The connection definition name can be used as a shorthand for the WBEM server via the '--name' 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, the connection definition with that name from the connections file is shown.
* If the NAME argument is '?', the command presents a list of connection definitions from the connections file and
prompts the user for selecting one, which is then shown.
* If the NAME argument is omitted, the current connection is shown.
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.
--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
-s, --sort Sort by instance count. Otherwise sorted by class name.
-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.
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 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 CIM qualifier declarations in the WBEM Server.
Creation, modification and deletion of qualifier declarations 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 'qualifier' keyword.
Command Options:
-h, --help Show this help message.
Commands:
get Get a qualifier declaration.
enumerate List the qualifier declarations in a namespace.
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, 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.
interop Get the Interop namespace of the server.
brand Get the brand of the server.
info Get information about the server.
profiles List management profiles advertized by the server.
centralinsts List central instances of mgmt profiles on the server.
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 centralinsts –help¶
Help text for pywbemcli server centralinsts
(see server centralinsts command):
Usage: pywbemcli [GENERAL-OPTIONS] server centralinsts [COMMAND-OPTIONS]
List central instances of mgmt profiles 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 used. 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 scopig methodology
--sc, --scoping-class CLASSNAME
Optional. Required only if profiles supports only scopig methodology
--sp, --scoping-path CLASSLIST Optional. Required only if profiles supports only scopig methodology. Multiples
allowed
--rd, --reference-direction [snia|dmtf]
Navigation direction for association. [default: dmtf]
-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.
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.
Command Options:
-h, --help Show this help message.
pywbemcli server profiles –help¶
Help text for pywbemcli server profiles
(see server profiles command):
Usage: pywbemcli [GENERAL-OPTIONS] server profiles [COMMAND-OPTIONS]
List management profiles advertized by the server.
Retrieve the CIM instances representing the WBEM management profiles advertized 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.
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.
Python files: If the file extension is
.py
, the file is considered a Python file. The file is executed using Python’sexec()
(i.e. with module namespace__builtin__
), and 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.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.
The Python script 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()
.The Python script can also extend the capabilities of the mock WBEM server by implementing callbacks via
pywbem_mock.method_callback_interface()
, for handling CIM method invocations against the mock WBEM server.
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.
Creating files for the mock repository¶
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 Python code (in a file tst_file.py
) that will add the same
CIM objects as in the MOF file to the mock repository using
add_cim_objects()
. 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()
As you can see, adding CIM objects with a MOF file is more compact, but of course the Python script can contain logic, and it provides for implementing CIM method calls via callbacks.
It is possible to mix MOF files and Python scripts by specifying the --mock-server general option multiple times.
The pywbemcli command to use this Python file for loading into a mock WBEM server, and then to enumerate its CIM class names is:
$ pywbemcli --mock-server tst_file.py class enumerate --names-only
CIM_Foo
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.
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
py: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.
- WBEM connection definitions file
- 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. The
file name of the connections file is
pywbemcli_connection_definitions.yaml
in the current directory. Multiple connections files may exist in different directories. This allows connection definitions to be predefined and pywbemcli commands executed against them using only the connection definition name (via the --name 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
- DMTF DSP0004, CIM Infrastructure, Version 2.8
- DSP0200
- DMTF DSP0200, CIM Operations over HTTP, Version 1.4
- DSP0201
- DMTF DSP0201, Representation of CIM in XML, Version 2.4
- DSP0202
- DMTF DSP0202, CIM Query Language Specification, Version 1.0
- DSP0207
- DMTF DSP0207, WBEM URI Mapping, Version 1.0
- DSP0212
- DMTF DSP0212, Filter Query Language, Version 1.0
- DSP1001
- DMTF DSP1001, Management Profile Specification Usage Guide, Version 1.1
- DSP1033
- DMTF DSP1033, Profile Registration Profile, Version 1.1
- RFC3986
- IETF RFC3986, Uniform Resource Identifier (URI): Generic Syntax, January 2005
- RFC6874
- IETF RFC6874, Representing IPv6 Zone Identifiers in Address Literals and Uniform Resource Identifiers, February 2013
- WBEM Standards
- DMTF WBEM Standards
- SMI-S
- SNIA Storage Management Initiative Specification
- 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.7.3¶
Released: 2020-10-06
Bug fixes:
- 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.
- 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)
- Test: Fixed qualifier definitions in qualifier_filter_model.mof to accomodate improved MOF compiler in pywbem 1.1.0. (see issue #788)
pywbemtools 0.7.2¶
Released: 2020-10-05
Bug fixes:
- Test: Fixed attempt in test_class_cmds.py to invoke a non-static method on a class object. (see issue #707)
- Test: Preventive fix for potential issue with virtualenv raising AttributeError during installtest on Python 3.4. (see issue #775)
pywbemtools 0.7.1¶
Released: 2020-07-31
Bug fixes:
- 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)
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)
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 connection file location functionality so that default is the users home directory but any other directory 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)