Repository : http://git.fedorahosted.org/cgit/cura-tools.git
On branch : openlmi-tools-lmiwbem
>---------------------------------------------------------------
commit 212343ebbf33ae531c478e061cb79c937da6385a
Author: Peter Hatina <phatina(a)redhat.com>
Date: Wed May 28 09:49:51 2014 +0200
check for job presence in synchronous method calls
>---------------------------------------------------------------
cli/lmi/shell/LMIMethod.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/cli/lmi/shell/LMIMethod.py b/cli/lmi/shell/LMIMethod.py
index 8ef82e8..30e93e0 100644
--- a/cli/lmi/shell/LMIMethod.py
+++ b/cli/lmi/shell/LMIMethod.py
@@ -583,7 +583,7 @@ class LMIMethod(LMIWrapperBaseObject):
# Check if we can perform synchronous method call
job = call_rparams.get("job", None)
can_perform_sync_call = False
- if job.classname in LMIMethod._INDICATION_JOB_CLASSNAMES:
+ if job and job.classname in LMIMethod._INDICATION_JOB_CLASSNAMES:
can_perform_sync_call = True
if self._sync_method and job and can_perform_sync_call:
# We work with LMIInstance object, which simplifies the code
Repository : http://git.fedorahosted.org/cgit/cura-tools.git
On branch : openlmi-tools-lmiwbem
>---------------------------------------------------------------
commit 2a0a6b8bb5810b78fcfff1e415bf95bcb9c68047
Author: Peter Hatina <phatina(a)redhat.com>
Date: Mon May 26 09:38:31 2014 +0200
code cleanup
>---------------------------------------------------------------
cli/lmi/shell/LMIBaseClient.py | 6 +++---
cli/lmi/shell/LMIClass.py | 6 +++---
cli/lmi/shell/LMIConsole.py | 4 ++--
cli/lmi/shell/LMIConstantValues.py | 4 ++--
cli/lmi/shell/LMIFormatter.py | 2 +-
cli/lmi/shell/LMIInstance.py | 2 +-
cli/lmi/shell/LMIMethod.py | 4 ++--
cli/lmi/shell/LMIUtil.py | 2 +-
8 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/cli/lmi/shell/LMIBaseClient.py b/cli/lmi/shell/LMIBaseClient.py
index f300d66..54f70d9 100644
--- a/cli/lmi/shell/LMIBaseClient.py
+++ b/cli/lmi/shell/LMIBaseClient.py
@@ -163,7 +163,7 @@ class LMIBaseClient(object):
inst_name_list_filtered = []
for inst_name in inst_name_list:
append = True
- for (filter_key, filter_value) in inst_filter.iteritems():
+ for filter_key, filter_value in inst_filter.iteritems():
if inst_name[filter_key] != filter_value:
append = False
break
@@ -266,7 +266,7 @@ class LMIBaseClient(object):
if inst_filter:
more = False
query += " where"
- for (filter_key, filter_value) in inst_filter.iteritems():
+ for filter_key, filter_value in inst_filter.iteritems():
if more:
query += " and"
quotes = isinstance(filter_value, basestring)
@@ -292,7 +292,7 @@ class LMIBaseClient(object):
if inst_list and inst_filter:
inst_list_filtered = []
for inst in inst_list:
- for (filter_key, filter_value) in inst_filter.iteritems():
+ for filter_key, filter_value in inst_filter.iteritems():
if not filter_key in inst.properties or \
inst.properties[filter_key].value != filter_value:
break
diff --git a/cli/lmi/shell/LMIClass.py b/cli/lmi/shell/LMIClass.py
index 0b3d856..72fa765 100644
--- a/cli/lmi/shell/LMIClass.py
+++ b/cli/lmi/shell/LMIClass.py
@@ -95,7 +95,7 @@ class LMIClass(LMIWrapperBaseObject):
properties = properties if not properties is None else {}
qualifiers = qualifiers if not qualifiers is None else {}
self_properties = self._cim_class.properties
- for (key, value) in properties.iteritems():
+ for key, value in properties.iteritems():
if not key in self._cim_class.properties:
errorstr = "No such instance property '%s'" % key
lmi_raise_or_dump_exception(LMIUnknownPropertyError(errorstr))
@@ -164,7 +164,7 @@ class LMIClass(LMIWrapperBaseObject):
if full_fetch:
self._cim_class_full_fetch = full_fetch
# Store the constant values as a list. This can consume some time, if computed on demand.
- self._valuemap_properties_list = [k for (k, v) in self._cim_class.properties.iteritems() \
+ self._valuemap_properties_list = [k for k, v in self._cim_class.properties.iteritems() \
if "ValueMap" in v.qualifiers and "Values" in v.qualifiers]
# NOTE: usage with Key=something, Value=something is deprecated
@@ -353,7 +353,7 @@ class LMIClass(LMIWrapperBaseObject):
# can be called in the synchronous way. One type of such method is the
# method, which has its "counterpart" class __MethodParameters_<Method>.
# The other one is the method, which defines a Job return paremeter.
- for (name, method) in self._cim_class.methods.iteritems():
+ for name, method in self._cim_class.methods.iteritems():
if "__MethodParameters_" + name in class_names or \
"Job" in method.parameters:
methods_lst.append("Sync" + name)
diff --git a/cli/lmi/shell/LMIConsole.py b/cli/lmi/shell/LMIConsole.py
index 325828e..c9b04c7 100644
--- a/cli/lmi/shell/LMIConsole.py
+++ b/cli/lmi/shell/LMIConsole.py
@@ -146,7 +146,7 @@ class LMIConsole(code.InteractiveConsole):
if locals is None:
locals = {}
else:
- for (k, v) in locals.iteritems():
+ for k, v in locals.iteritems():
if isinstance(v, LMIConnection):
locals[k]._client.interactive = True
locals["clear_history"] = self.clear_history
@@ -239,7 +239,7 @@ class LMIConsole(code.InteractiveConsole):
if locals is None:
locals = {}
else:
- for (k, v) in locals.iteritems():
+ for k, v in locals.iteritems():
if isinstance(v, LMIConnection):
locals[k]._client.interactive = False
locals["connect"] = connect
diff --git a/cli/lmi/shell/LMIConstantValues.py b/cli/lmi/shell/LMIConstantValues.py
index 2f4a61d..5642cb9 100644
--- a/cli/lmi/shell/LMIConstantValues.py
+++ b/cli/lmi/shell/LMIConstantValues.py
@@ -44,7 +44,7 @@ class LMIConstantValues(object):
self._cast_type = cast_type
# Fill two dictionaries for bidirectional access to constant values.
cnt = 1
- for (key, value) in items:
+ for key, value in items:
try:
# Cast constant value first. If we get ValueError, no key
# modifications are necessary.
@@ -75,7 +75,7 @@ class LMIConstantValues(object):
:returns: pretty string
"""
result = ""
- for (k, v) in self._value_map.iteritems():
+ for k, v in self._value_map.iteritems():
result += "%s = %s\n" % (k, v)
return result[:-1]
diff --git a/cli/lmi/shell/LMIFormatter.py b/cli/lmi/shell/LMIFormatter.py
index c8193a6..47d5276 100644
--- a/cli/lmi/shell/LMIFormatter.py
+++ b/cli/lmi/shell/LMIFormatter.py
@@ -37,7 +37,7 @@ def _which(program):
:returns: full path of a selected executable
:rtype: string
"""
- (fpath, fname) = os.path.split(program)
+ fpath, fname = os.path.split(program)
if fpath:
if _is_executable(program):
return program
diff --git a/cli/lmi/shell/LMIInstance.py b/cli/lmi/shell/LMIInstance.py
index 118d45c..9085ef7 100644
--- a/cli/lmi/shell/LMIInstance.py
+++ b/cli/lmi/shell/LMIInstance.py
@@ -599,7 +599,7 @@ class LMIInstance(LMIWrapperBaseObject):
**Usage:** :ref:`instances_properties`.
"""
- for (name, prop) in self._cim_instance.properties.iteritems():
+ for name, prop in self._cim_instance.properties.iteritems():
value = str(prop.value)
if isinstance(prop.value, basestring):
value = "'%s'" % value
diff --git a/cli/lmi/shell/LMIMethod.py b/cli/lmi/shell/LMIMethod.py
index c612641..1cc84d5 100644
--- a/cli/lmi/shell/LMIMethod.py
+++ b/cli/lmi/shell/LMIMethod.py
@@ -179,7 +179,7 @@ class LMIMethod(LMIWrapperBaseObject):
self._lmi_instance._lmi_class.fetch(True)
self._method = self._lmi_instance._lmi_class._cim_class.methods[method]
# Store the constant values as a list. This can consume some time, if computed on demand.
- self._valuemap_parameters_list = [k for (k, v) in self._method.parameters.iteritems() \
+ self._valuemap_parameters_list = [k for k, v in self._method.parameters.iteritems() \
if "ValueMap" in v.qualifiers]
# For simplicity, we add return value constants to the same list
if "ValueMap" in self._method.qualifiers:
@@ -526,7 +526,7 @@ class LMIMethod(LMIWrapperBaseObject):
if method_args is None:
method_args = {}
method_args.update(kwargs)
- for (param, value) in method_args.iteritems():
+ for param, value in method_args.iteritems():
if param in self._method.parameters:
# Cast input parameters into acceptable CIM types
t = self._method.parameters[param].type
diff --git a/cli/lmi/shell/LMIUtil.py b/cli/lmi/shell/LMIUtil.py
index cb41d83..7e6dc6f 100644
--- a/cli/lmi/shell/LMIUtil.py
+++ b/cli/lmi/shell/LMIUtil.py
@@ -359,7 +359,7 @@ def lmi_associators(assoc_classes):
# Reference properties
ref_props = [
ref_prop_name \
- for (ref_prop_name, ref_prop) in assoc_class._cim_class.properties.iteritems() \
+ for ref_prop_name, ref_prop in assoc_class._cim_class.properties.iteritems() \
if ref_prop.type == "reference"
]
Repository : http://git.fedorahosted.org/cgit/cura-tools.git
On branch : openlmi-tools-lmiwbem
>---------------------------------------------------------------
commit 53fa4f803fd2de51084493ad8824890d2ac1d3df
Author: Peter Hatina <phatina(a)redhat.com>
Date: Mon May 26 08:48:25 2014 +0200
drop unused LMIBaseClient::_get_classes()
>---------------------------------------------------------------
cli/lmi/shell/LMIBaseClient.py | 35 -----------------------------------
1 files changed, 0 insertions(+), 35 deletions(-)
diff --git a/cli/lmi/shell/LMIBaseClient.py b/cli/lmi/shell/LMIBaseClient.py
index ac0e7de..f300d66 100644
--- a/cli/lmi/shell/LMIBaseClient.py
+++ b/cli/lmi/shell/LMIBaseClient.py
@@ -326,41 +326,6 @@ class LMIBaseClient(object):
rval=self._cliconn.EnumerateClassNames(
namespace, **kwargs))
- # TODO: remove?
- @lmi_process_cim_exceptions(
- cimerror_callable=lambda r, e: [],
- conerror_callable=lambda r, e: [])
- def _get_classes(self, namespace=None, **kwargs):
- """
- Returns a :py:class:`CIMClass` object.
-
- :param string namespace: namespace, from which the class names list
- should be retrieved; if None, default namespace will be used (**NOTE:** see
- :py:mod:`wbem`)
- :param string ClassName: defines the class that is the basis for the enumeration.
- If the ClassName input parameter is absent, this implies that the names of all
- classes. Default value is None.
- :param bool DeepInheritance: if not present, of False, only the names of immediate
- child subclasses are returned, otherwise the names of all subclasses of the
- specified class should be returned. Default value is False.
- :param bool LocalOnly: indicates, if any CIM elements (properties, methods, and
- qualifiers) except those added or overridden in the class as specified in the
- classname input parameter shall not be included in the returned class.
- :param bool IncludeQualifiers: indicates, if all qualifiers for each class
- (including qualifiers on the class and on any returned properties, methods, or
- method parameters) shall be included as ``<QUALIFIER>`` elements in the
- response.
- :param bool IncludeClassOrigin: indicates, if the ``CLASSORIGIN`` attribute shall
- be present on all appropriate elements in each returned class.
- :returns: :py:class:`.LMIReturnValue` object with ``rval`` set to a list of
- :py:class:`CIMClass` objects, if no error occurs; otherwise ``rval`` is set to
- None and ``errorstr`` to appropriate error string
- :raises: :py:exc:`CIMError`, :py:exc:`ConnectionError`
- """
- return LMIReturnValue(
- rval=self._cliconn.EnumerateClasses(
- namespace, **kwargs))
-
@lmi_process_cim_exceptions()
def _get_class(self, class_name, namespace=None, **kwargs):
"""
Repository : http://git.fedorahosted.org/cgit/cura-tools.git
On branch : openlmi-tools-lmiwbem
>---------------------------------------------------------------
commit 7ced4435bdabcec146a45bdafa121f7e8c292ab9
Author: Peter Hatina <phatina(a)redhat.com>
Date: Fri May 23 15:00:34 2014 +0200
introduce compatibility module
LMIShell primarily uses LMIWBEM as backend. If such module isn't
available, PyWBEM is used instead.
>---------------------------------------------------------------
Diff suppressed because of size. To see it, use:
git diff --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol ^7ced4435bdabcec146a45bdafa121f7e8c292ab9~1 7ced4435bdabcec146a45bdafa121f7e8c292ab9
Repository : http://git.fedorahosted.org/cgit/cura-tools.git
On branch : master
>---------------------------------------------------------------
commit eb41e45a42e6c8dcd2b5111340122b1a1e778b12
Author: Michal Minar <miminar(a)redhat.com>
Date: Tue Jun 17 13:15:13 2014 +0200
lmi: extended manpage, improved help
>---------------------------------------------------------------
cli/lmi/scripts/_metacommand/toplevel.py | 10 +++++-----
cli/man/generate.sh | 27 ++++++++++++++++++++++++++-
cli/man/lmi.1 | 16 +++++++++++++++-
3 files changed, 46 insertions(+), 7 deletions(-)
diff --git a/cli/lmi/scripts/_metacommand/toplevel.py b/cli/lmi/scripts/_metacommand/toplevel.py
index a0372a7..419a856 100644
--- a/cli/lmi/scripts/_metacommand/toplevel.py
+++ b/cli/lmi/scripts/_metacommand/toplevel.py
@@ -57,14 +57,14 @@ Options:
--version Print version of '%(cmd)s' in use and quit.
Handling hosts:
- If no --host or --hosts-file given the "localhost" is tried. When running
- under root with Pegasus CIMOM, this results in a connection over unix
- socket (without the need for credentials).
+ If no --host or --hosts-file are given, the "localhost" will be tried. When
+ running under root with Pegasus CIMOM, this results in a connection over
+ unix socket (no need to supply credentials).
Hosts may contain embedded credentials e.g.:
http://user:passwd@hostname:5988
- Avoid supplying them on command line though since arguments are visible in
- process table. Use --hosts-file option instead.
+ Avoid supplying them on command line though. Always prefer the --hosts-file
+ option.
"""
import docopt
diff --git a/cli/man/generate.sh b/cli/man/generate.sh
index a8a8e8d..e2b4dd9 100755
--- a/cli/man/generate.sh
+++ b/cli/man/generate.sh
@@ -16,6 +16,8 @@ configuration_file=`mktemp`
# pusg - parse usage
# wopt - wait for options
# popt - parse options
+# whts - wait for hosts handling section
+# phts - parse hosts handling section
state="desc"
re_option="^([[:blank:]]+)((-[-[:alpha:]_]+)"
re_option+="(\ [][:alpha:]<>_()[|-]+)*)(\ \ +(.*))?"
@@ -76,7 +78,7 @@ while IFS= read line; do
popt*)
if [[ "$line" =~ ^[[:blank:]]*$ ]]; then
printf "\n"
- break
+ state="whts"
elif [[ "$line" =~ $re_option ]]; then
opt_count=`echo $state | sed 's/^popt\([[:digit:]]\+\)/\1/'`
[ "$opt_count" -gt 0 ] && printf '\n'
@@ -89,6 +91,29 @@ while IFS= read line; do
fi
;;
+ "whts")
+ if [[ "$line" =~ ^[Hh]andling\ [Hh]osts ]]; then
+ printf ".SH HOSTS HANDLING\n"
+ state="phts"
+ fi
+ ;;
+
+ "phts")
+ if [[ "$line" =~ ^$ ]]; then
+ new_paragraph=1
+ elif ! [[ "$line" =~ ^[^[:space:]] ]]; then
+ if [[ ${new_paragraph:-0} = 1 ]]; then
+ printf ".P\n"
+ new_paragraph=0
+ fi
+ printf "$line\n" | sed -e 's/^ \{4\}//' -e 's/\s\+$//' \
+ -e 's/\s*\(--[[:alnum:]-]\+\|<[[:alnum:]_-]\+>\)\s\+/\n.B \1\n/g' \
+ -e 's/\s*\(--[[:alnum:]-]\+\|<[[:alnum:]_-]\+>\)$/\n.B \1/g'
+ else
+ break
+ fi
+ ;;
+
*) break
;;
diff --git a/cli/man/lmi.1 b/cli/man/lmi.1
index d402bf5..d3b771b 100644
--- a/cli/man/lmi.1
+++ b/cli/man/lmi.1
@@ -1,4 +1,4 @@
-.TH lmi 1 "October 2013" "openlmi-scripts 0.2.2" "User Commands"
+.TH lmi 1 "June 2014" "openlmi-scripts 0.9.1.1" "User Commands"
.SH NAME
lmi \- meta-command for managing systems with OpenLMI providers
@@ -65,6 +65,20 @@ Show this text and quit.
.TP
.I --version
Print version of 'lmi' in use and quit.
+.SH HOSTS HANDLING
+If no
+.B --host
+or
+.B --hosts-file
+are given, the "localhost" will be tried. When
+running under root with Pegasus CIMOM, this results in a connection over
+unix socket (no need to supply credentials).
+.P
+Hosts may contain embedded credentials e.g.:
+ http://user:passwd@hostname:5988
+Avoid supplying them on command line though. Always prefer the
+.B --hosts-file
+option.
.SH CONFIGURATION
There is a system-wide configuration file located at
`/etc/openlmi/lmi.conf` and user configuration file searched at `~/.lmirc`.
Repository : http://git.fedorahosted.org/cgit/cura-tools.git
On branch : master
>---------------------------------------------------------------
commit 6458d347a1ed55c8b5e927f04f38e73a84ca5c01
Author: Michal Minar <miminar(a)redhat.com>
Date: Thu Jun 12 12:54:29 2014 +0200
doc: fixed typo
>---------------------------------------------------------------
doc/src/scripts/script-tutorial.rst | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/doc/src/scripts/script-tutorial.rst b/doc/src/scripts/script-tutorial.rst
index 0b59247..3e0490c 100644
--- a/doc/src/scripts/script-tutorial.rst
+++ b/doc/src/scripts/script-tutorial.rst
@@ -266,7 +266,7 @@ Now we can install it and test it:
.. code-block:: sh
# make sure the $WSP is in $PYTHONPATH
- python mylf/stup.py develop --install-dir=$WSP
+ python mylf/setup.py develop --install-dir=$WSP
lmi help
lmi help mylf