Repository : http://git.fedorahosted.org/cgit/cura-tools.git
On branch : master
commit 6ea78607c261f689bb579a6c65741c050730a839 Author: Peter Hatina phatina@redhat.com Date: Fri Aug 9 12:10:00 2013 +0200
update man page
man/lmishell.1 | 144 ++++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 103 insertions(+), 41 deletions(-)
diff --git a/man/lmishell.1 b/man/lmishell.1 index 4eb5502..33ca818 100644 --- a/man/lmishell.1 +++ b/man/lmishell.1 @@ -1,4 +1,4 @@ -.TH lmishell "1" "July 2013" "openlmi-tools version 0.5" "User Commands" +.TH lmishell "1" "August 2013" "openlmi-tools v0.7" "User Commands" .SH NAME lmishell - (non)interactive WBEM client and interpreter. .SH SYNOPSIS @@ -9,11 +9,10 @@ lmishell provides a (non)interactive or interactive way how to access CIM objects provided by OpenPegasus or sblim-sfcb CIMOM.
OpenLMI Shell is based on a python interpreter and added logic, therefore what -you can do in pure python, it is possible in LMIShell. There are classes added -to manipulate with CIM classes, instance names, instances, etc. Additional -classes are added to fulfill wrapper pattern and expose only those methods, -which are necessary for the purpose of a shell. Following scheme depicts a -structure of the OpenLMI Shell. +is possible to do in pure python, it is possible in LMIShell. There are classes +added to manipulate with CIM classes, instance names, instances, etc. +Additional classes are added to fulfill wrapper pattern and expose only those +methods, which are necessary for the purpose of a shell. .SH OPTIONS The options may be given in any order before the first positional argument, which stands for the script name. @@ -33,6 +32,10 @@ Print all log messages to stderr. .TP \fB-q\fR \fB--quiet\fR Do not print any log messages to stderr. +.TP +\fB-n\fR \fB--noverify\fR +Do not verify server's certificate, if SSL used. By default, the certificate +validity check will be performed. .P By default, LMIShell prints out log messages with Error severity. Options \fB-v\fR, \fB-m\fR and \fB-q\fR are mutually exclusive and @@ -172,13 +175,22 @@ following code: ... >
-\fBNOTE:\fR The suffix "`Values`" privides a way, hot to access ValueMap properties. +\fBNOTE:\fR The suffix "`Values`" privides a way, how to access ValueMap properties.
To retrieve a constant value, see the next example:
> constant_value_names_lst = cls.PropertyValues.values() > cls.PropertyValues.ConstantValueName ConstantValue + > cls.PropertyValues.value("ConstantValueName") + ConstantValue + > +.SS GET VALUEMAP PROPERTY VALUE NAME +LMIShell can also return string representing constant value. See the following +code: + + > cls.PropertyValue.value_name(ConstantValue) + ConstantValueName > .SS GET INSTANCES Using a class object, you can access its instances. You can easily get a list @@ -268,14 +280,9 @@ To execute a method within an object, run this: > instance.Method( ... Param1=value1, ... Param2=value2, ...) - https://host: ok (0) + LMIReturnValue(rval=ReturnValue, rparams=ReturnParametersDictionary, errorstr="Possible error string") >
-See the result string after a method was executed. This kind of "display -sugar" is used only in the interactive mode. It displays a hostname, on which -the object method was executed and its return value "ok" or "fail" (it also -includes a return value in the parenthesis). - To get the result from a method call, see following:
> (rval, rparams, errorstr) = instance.Method( @@ -283,12 +290,12 @@ To get the result from a method call, see following: ... Param2=value2, ...) >
-The tuple in the previous example will contain retun value of the method call +The tuple in the previous example will contain return value of the method call (`rval`), returned parameters (`rparams`) and possible error string (`errorstr`). - -The LMIShell can perform synchronous method call, which means, that the -LMIShell is able to synchronously wait for a Job object to change its state to +.SS SYNCHRONOUS METHODS +LMIShell can perform synchronous method call, which means, that the LMIShell +is able to synchronously wait for a Job object to change its state to "finished" state and then return the job's return parameters. LMIShell can perform the synchrous method call, if the given method returns a object of following classes: @@ -297,8 +304,8 @@ following classes: * `LMI_SoftwareInstallationJob` * `LMI_NetworkJob`
-LMIShell first tries to use indications as the waiting method, but if it -fails, then it uses polling method instead. +LMIShell first tries to use indications as the waiting method. If it fails, +then it uses polling method instead.
Following example illustrates, how to perform a synchronous method call:
@@ -313,6 +320,61 @@ When a synchronous method call is done:
* `rval` will contain the job's return value * `rparams` will contain the job's return parameters + * `errorstr` will contain job's possible error string + +It is possible to force LMIShell to use only polling method, see the next +example: + + > (rval, rparams, errorstr) = instance.SyncMethod( + ... PreferPolling=True, + ... Param1=value1, + ... Param2=value2, ...) + > +.TP 4 +.B VALUEMAP PARAMETERS +A CIM Method may contain ValueMap parameters (aliases for constant values) in +its MOF definition. To access these parameters, which contain constant values, +see following code: + + > instance.Method.print_valuemap_parameters() + ... + > valuemap_parameters = instance.Method.valuemap_parameters() + > +.TP 4 +.B GET VALUEMAP PARAMETER VALUE +By using a ValueMap parameters, you can retrieve a constant value defined in +the MOF file for a specific method. To get a list of all available constants, +their values, use the following code: + + > instance.Method.ParameterValues.print_values() + ... + > + +\fBNOTE:\fR The suffix "Values" privides a way, how to access ValueMap parameters. + +To retrieve a constant value, see the next example: + + > constant_value_names_lst = instance.Method.ParameterValues.values() + > instance.Method.ParameterValues.ConstantValueName + ConstantValue + > instance.Method.ParameterValues.value("ConstantValueName") + ConstantValue + > +.TP 4 +.B GET VALUEMAP PARAMETER +Method can also contain a mapping between constant property name and +corresponding value. Following code demonstrates, how to access such +parameters: + + > instance.Method.ConstantValueName +.TP 4 +.B GET VALUEMAP PARAMETER VALUE NAME +LMIShell can also return string representing constant value. See the following +code: + + > instance.Method.ParameterValue.value_name(ConstantValue) + ConstantValueName + > .SS PROPERTIES You can also access an instance object properties. To get a property, see the following example. @@ -325,7 +387,7 @@ To modify a property, execute following:
> instance.Property = NewPropertyValue > instance.push() - https://host: ok (0) + LMIReturnValue(rval=0, rparams={}, errorstr='') >
\fBNOTE:\fR If you change an instance object property, you have to execute a `.push()` method to propagate the change to the CIMOM. @@ -510,7 +572,8 @@ subscription, by which we can receive such event responses. .SS SUBSCRIBING TO AN INDICATION The shell is capable of creating an indication subscription with the filter and handler objects in one single step. This example is based upon sblim-cmpi- -base provider. How to subscribe to an indication, please, follow next example: +base provider. How to subscribe to an indication, please, follow the next +example:
> # When connecting to CIMOM, ensure, that the user account can create objects in the namespace root/PG_InterOp > c = connect("host", "privileged_user", "password") @@ -526,7 +589,7 @@ base provider. How to subscribe to an indication, please, follow next example: ... HandlerSystemCreationClassName="CIM_ComputerSystem", ... Destination="http://192.168.122.1:5988" # this is the destination computer, where all the indications will be delivered ... ) - https://hostname: ok (True) + LMIReturnValue(rval=True, rparams={}, errorstr='') >
In this state, we have a indication subscription created. @@ -549,7 +612,7 @@ shell quits. If you want to delete the subscriptions sooner, you can use following methods:
> c.unsubscribe_indication(indication_name) - https://hostname: ok (True) + LMIReturnValue(rval=True, rparams={}, errorstr='') > c.unsubscribe_all_indications() > .SS INDICATION HANDLER @@ -618,14 +681,6 @@ The LMIShell can also search in the history of commands by hitting ` <ctrl+r> ` and typing the command prefix (as your default shell does).
(reverse-i-search)`connect': c = connect("host", "username") -.SS DISPLAY SUGAR -Interactive interface by default uses "display sugar" when calling a method in -the format `"http(s)://hostname: ok/fail (numberic_value)"` as a display -replacement for object of a `ReturnValue` class. This feature can be disabled -by executing: - - > use_display_sugar(False) - > .SS EXCEPTION HANDLING Exception handling by the shell can be turned off -- since then, all the exceptions need to be handled by your code. To allow all the exceptions to @@ -639,7 +694,7 @@ To turn exception handling by the shell back on, run this: > use_exceptions(False) > .SS CACHE -The shell's connection objects use a temporary cache for storing CIM class +The LMIShell's connection objects use a temporary cache for storing CIM class names and CIM classes to save network communication.
The cache can be cleared, see following example: @@ -649,30 +704,37 @@ The cache can be cleared, see following example:
The cache can be also turned off, see next example:
- > c.use_cache(False) # disables the cache usage + > c.use_cache(False) > .TP 4 .B TAB-COMPLETION Interactive interface also supports tab-completion for basic programming structures and also for CIM objects (such as namespace, classes, methods and -properties completion, ). Following code shows a few examples: +properties completion, ). Following code shows few examples:
- > c = conn<tab> # expands to: see next line + > c = conn<tab> > c = connect(
- > lmi_service_class = c.root.c<tab> # see next line + > lmi_service_class = c.root.c<tab> > lmi_service_class = c.root.cimv2 - > lmi_service_class = c.root.cimv2.lmi_ser<tab> # see next line - > lmi_service_class = c.root.cimv2.LMI_Service # it also fixes upper/lower case in the class name + > lmi_service_class = c.root.cimv2.lmi_ser<tab> + > lmi_service_class = c.root.cimv2.LMI_Service
- > sshd_service = lmi_s<tab> # see next line + > sshd_service = lmi_s<tab> > sshd_service = lmi_service_class
- > sshd_service.Stat<tab> # see next line + > sshd_service.Stat<tab> > sshd_service.Status
- > sshd_service.Res<tab> # see next line + > sshd_service.Res<tab> > sshd_service.RestartService( + + > lmi_service_class.Req<tab> + > lmi_service_class.RequestedStateChangeValues + > lmi_service_class.RequestesStateChangeValues.Sh<tab> + > lmi_service_class.RequestedStateChangeValues.Shutdown + > # similar for method calls, as well + > .SS CONFIGURATION FILE The LMIShell has a tiny configuration file with location `~/.lmishellrc`. In configuration file, you can set these properties:
cura-tools-devel@lists.fedorahosted.org