Repository : http://git.fedorahosted.org/cgit/cura-tools.git
On branch : master
>---------------------------------------------------------------
commit b791831ebf54e93709786152185b6f85e6f13b56
Author: Peter Hatina <phatina(a)redhat.com>
Date: Mon Dec 8 14:25:33 2014 +0100
bump release version to 0.10.3
>---------------------------------------------------------------
cli/lmi/shell/LMIShellVersion.py | 2 +-
cli/man/lmi.1 | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/cli/lmi/shell/LMIShellVersion.py b/cli/lmi/shell/LMIShellVersion.py
index e951d1a..14b6dcb 100644
--- a/cli/lmi/shell/LMIShellVersion.py
+++ b/cli/lmi/shell/LMIShellVersion.py
@@ -13,4 +13,4 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
-__version__ = "0.10.2"
+__version__ = "0.10.3"
diff --git a/cli/man/lmi.1 b/cli/man/lmi.1
index 1ee7a63..799a1db 100644
--- a/cli/man/lmi.1
+++ b/cli/man/lmi.1
@@ -1,4 +1,4 @@
-.TH lmi 1 "October 2014" "openlmi-scripts 1.0.0" "User Commands"
+.TH lmi 1 "December 2014" "openlmi-scripts 0.10.3" "User Commands"
.SH NAME
lmi \- meta-command for managing systems with OpenLMI providers
Repository : http://git.fedorahosted.org/cgit/cura-tools.git
On branch : master
>---------------------------------------------------------------
commit 4de94218135761cb3af126c6e938701388ed63d0
Author: Michal Minar <miminar(a)redhat.com>
Date: Fri Oct 31 14:06:01 2014 +0100
READMEs cleanup
Removed cli/README.md which is just metacommand related and contains
redundat information (openlmi-scripts/README.md contains most of it and
is up to date).
Resolves: ticket #323
>---------------------------------------------------------------
README.md | 6 +-
cli/Makefile | 2 +-
cli/README.md | 133 ---------------------------------------------------------
3 files changed, 4 insertions(+), 137 deletions(-)
diff --git a/README.md b/README.md
index 693e5fe..f5148ca 100644
--- a/README.md
+++ b/README.md
@@ -10,9 +10,9 @@ bindings, standard APIs, and standard scripting interfaces.
OpenLMI-tools
=============
-OpenLMI-tools currently contains LMIShell, a (non)interactive command
-interpreter for CIM objects access and LMI-Meta Command, which serves as a
-command line interface to OpenLMI Providers, which utilizes LMIShell.
+OpenLMI-tools currently contains *LMIShell*, a (non)interactive command
+interpreter for CIM objects access and *LMI metacommand*, which serves as a
+command line interface to OpenLMI Providers, which utilizes *LMIShell*.
Dependencies
------------
diff --git a/cli/Makefile b/cli/Makefile
index b15c149..33b582e 100644
--- a/cli/Makefile
+++ b/cli/Makefile
@@ -3,7 +3,7 @@ include ../Makefile.inc
PYTHONPATH ?= $(HOME)/workspace/python_sandbox
DEVELOPDIR ?= $(PYTHONPATH)
DOCDIR := $(ROOTDIR)/doc
-SOURCE ?= README.md
+SOURCE ?= ../README.md
TARGET ?= README.txt
.PHONY: all readme sdist clean setup develop
diff --git a/cli/README.md b/cli/README.md
deleted file mode 100644
index 9e93cb8..0000000
--- a/cli/README.md
+++ /dev/null
@@ -1,133 +0,0 @@
-openlmi-scripts
-===============
-Client-side python modules and command line utilities.
-
-It comprises of one binary called `lmi` and a common library. `lmi`
-meta-command allows to run commands on a set of OpenLMI providers. These
-commands can be installed separately in a modular way.
-
-`lmi` is a command line application allowing to run single command on a set
-of hosts with just one statement from `shell` or it can run in an
-interactive way.
-
-For more information please refer to online documentation on [pythonhosted][]
-or build your own in `doc/` directory.
-
-Dependencies
-------------
-Code base is written for `python 2.7`.
-There are following python dependencies:
-
- * python-docopt
-
-### Uploading to PyPI
-Since *PyPI* expects README file to be in a *reStructuredText* markup
-language and the one present is written in *markdown*, it needs to be
-converted to it. So please make sure you have `pandoc` installed before
-running:
-
- $ python setup.py sdist upload
-
-Installation
-------------
-Use standard `setuptools` script for installation:
-
- $ cd openlmi-scripts
- $ python setup.py install --user
-
-This installs just the *lmi meta-command* and client-side library. To install
-subcommands, you need to do the same procedure for each particular command
-under `commands/` directory.
-
-Script eggs are also available on *PyPI*, install them with:
-
- $ pip install --user openlmi-scripts
- $ # add any provider you want to interact with
- $ pip install --user openlmi-scripts-service openlmi-scripts-software
-
-Usage
------
-To get a help and see available commands, run:
-
- $ lmi help
-
-To get a help for particular command, run:
-
- $ lmi help service
-
-To issue single command on a host, run:
-
- $ lmi --host ${hostname} service list
-
-To start the app in interactive mode:
-
- $ lmi --host ${hostname}
- > service list --disabled
- ...
- > service start svnserve.service
- ...
- > quit
-
-Developing lmi scripts.
------------------------
-
-This documents how to quickly develop lmi scripts without the need to
-reinstall python eggs, when anything is changed. This presumes, that the
-development process takes place in a git repotory checked out from [git][].
-It can be located anywhere on system.
-
-Before we start with setting up an environment, please double check, that you
-don't have installed anything from openlmi-scripts in system path
-(`/usr/lib/python2.7/site-packages/lmi/scripts` should not exist). And make
-sure, that user path is also cleared:
-
- $ rm -rf $HOME/.local/lib/python2.7/site-packages/lmi*
- $ rm -rf $HOME/.local/lib/python2.7/site-packages/openlmi*
-
-Install all dependencies:
-
- * python-docopt
- * openlmi-python-base
- * openlmi-tools
-
-Either via rpms or from respective git repositories. For openlmi-python-base
-package contained in [providers-git][] repository the setup script is
-located at `src/python/setup.py`. In future these will be available from PyPi.
-
-Let's setup an environment:
-
- 1. Create a workspace directory for current `$USER` (let's call it a `WSP`).
- This is a place, where our eggs and binaries will be "installed".
- It can be located anywhere, for example:
-
- $ WSP=~/.python_workspace
- $ mkdir $WSP
-
- 2. Add workspace to your python path to make all modules installed there
- importable (you can add this to your `~/.bashrc`):
-
- $ export PYTHONPATH=$WSP:$PYTHONPATH
-
- 3. Add workspace to your PATH, so the installed binaries can be run:
-
- $ export PATH=$WSP:$PATH
-
- 4. Now let's "install" to our workspace. First `cd` to checked out
- openlmi-scripts repository.
- 5. Install them and any commands you want -- possibly your own
-
- $ python setup.py develop --install-dir=$WSP
- $ for cmd in service storage; do
- > pushd commands/$cmd
- > python setup.py develop --install-dir=$WSP
- > popd
- > done
-
-Now any change made to openlmi-scripts is immediately reflected in `lmi`
-meta-command.
-
-------------------------------------------------------------------------------
-[git]: https://github.com/openlmi/openlmi-scripts "openlmi-scripts"
-[providers-git]: https://fedorahosted.org/openlmi/browser/openlmi-providers "openlmi-providers"
-[pythonhosted]: http://pythonhosted.org/openlmi-scripts/index.html "python hosted"
-[PyPI]: https://pypi.python.org/pypi/openlmi-tools "PyPI"
Repository : http://git.fedorahosted.org/cgit/cura-tools.git
On branch : master
>---------------------------------------------------------------
commit 2128c15e299de4e1fc927641bcd8c7e89eddf81d
Author: Peter Hatina <phatina(a)redhat.com>
Date: Wed Oct 29 08:45:00 2014 +0100
bump release version to 0.10.2
>---------------------------------------------------------------
cli/lmi/shell/LMIShellVersion.py | 2 +-
cli/man/lmi.1 | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/cli/lmi/shell/LMIShellVersion.py b/cli/lmi/shell/LMIShellVersion.py
index d32920a..e951d1a 100644
--- a/cli/lmi/shell/LMIShellVersion.py
+++ b/cli/lmi/shell/LMIShellVersion.py
@@ -13,4 +13,4 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
-__version__ = "0.10.1"
+__version__ = "0.10.2"
diff --git a/cli/man/lmi.1 b/cli/man/lmi.1
index f803377..1ee7a63 100644
--- a/cli/man/lmi.1
+++ b/cli/man/lmi.1
@@ -1,4 +1,4 @@
-.TH lmi 1 "September 2014" "openlmi-scripts 1.0.0" "User Commands"
+.TH lmi 1 "October 2014" "openlmi-scripts 1.0.0" "User Commands"
.SH NAME
lmi \- meta-command for managing systems with OpenLMI providers
Repository : http://git.fedorahosted.org/cgit/cura-tools.git
On branch : master
>---------------------------------------------------------------
commit 8f4689671458964ca24c853014904a30112f0035
Author: Michal Minar <miminar(a)redhat.com>
Date: Wed Oct 8 13:57:38 2014 +0200
scripts: added CONNECTION_TIMEOUT property
Allow to override default connection timeout on particular commands.
>---------------------------------------------------------------
cli/lmi/scripts/common/command/meta.py | 19 ++++++++++++++++++-
cli/lmi/scripts/common/command/session.py | 17 +++++++++++++++++
doc/src/scripts/devel/command-properties.rst | 10 +++++++++-
3 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/cli/lmi/scripts/common/command/meta.py b/cli/lmi/scripts/common/command/meta.py
index 3e9db7b..d34410c 100644
--- a/cli/lmi/scripts/common/command/meta.py
+++ b/cli/lmi/scripts/common/command/meta.py
@@ -125,6 +125,19 @@ def _handle_namespace(dcl):
return namespace
dcl['cim_namespace'] = classmethod(_new_cim_namespace)
+def _handle_connection_timeout(dcl):
+ """
+ Overrides ``connection_timeout()`` class method if ``CONNECTION_TIMEOUT``
+ property is given.
+
+ :param dictionary dcl: Class dictionary being modified by this method.
+ """
+ if 'CONNECTION_TIMEOUT' in dcl:
+ timeout = dcl.pop('CONNECTION_TIMEOUT')
+ def _new_connection_timeout(_cls):
+ return timeout
+ dcl['connection_timeout'] = classmethod(_new_connection_timeout)
+
def _handle_callable(name, bases, dcl):
"""
Process the ``CALLABLE`` property of end-point command. Create the
@@ -597,7 +610,7 @@ class EndPointCommandMetaClass(abc.ABCMeta):
class SessionCommandMetaClass(EndPointCommandMetaClass):
"""
Meta class for commands operating upon a session object.
- All associated functions take as first argument an namespace abstraction
+ All associated functions take as first argument a namespace abstraction
of type ``lmi.shell``.
Handles following class properties:
@@ -607,10 +620,14 @@ class SessionCommandMetaClass(EndPointCommandMetaClass):
function. Defaults to ``"root/cimv2"``. If ``False``, raw
:py:class:`lmi.shell.LMIConnection` object will be passed to
associated function.
+ ``CONNECTION_TIMEOUT`` : ``int``
+ Maximum number of seconds to wait for broker's response. If reached,
+ :py:class:`~lmi.shell.LMIExceptions.ConnectionError` will be raised.
"""
def __new__(mcs, name, bases, dcl):
_handle_usage(name, bases, dcl)
_handle_namespace(dcl)
+ _handle_connection_timeout(dcl)
_handle_callable(name, bases, dcl)
return EndPointCommandMetaClass.__new__(mcs, name, bases, dcl)
diff --git a/cli/lmi/scripts/common/command/session.py b/cli/lmi/scripts/common/command/session.py
index da22b4a..cbbf9fa 100644
--- a/cli/lmi/scripts/common/command/session.py
+++ b/cli/lmi/scripts/common/command/session.py
@@ -54,6 +54,16 @@ class LmiSessionCommand(LmiEndPointCommand):
return Configuration.get_instance().namespace
@classmethod
+ def connection_timeout(cls):
+ """
+ Returns maximum number of seconds the client shall wait for broker's
+ reply. Defaults to ``None`` which means that it's up to the connection
+ object itself to decide. It can be oveririden with
+ ``CONNECTION_TIMEOUT`` property in declaration of command.
+ """
+ return None
+
+ @classmethod
def dest_pos_args_count(cls):
"""
There is a namespace/connection object passed as the first positional
@@ -181,6 +191,13 @@ class LmiSessionCommand(LmiEndPointCommand):
raise TypeError("expected an instance of LMIConnection for"
" connection argument, not %s" % repr(connection))
namespace = self.cim_namespace()
+ timeout = self.connection_timeout()
+ if timeout is not None:
+ if hasattr(connection.connection, "timeout"):
+ LOG().debug("Set connection timeout to %d seconds.", timeout)
+ connection.timeout = timeout * 1000
+ else:
+ LOG().debug("Could not set connection timeout.")
if namespace is not None:
connection = LMIUtil.lmi_wrap_cim_namespace(
connection, namespace)
diff --git a/doc/src/scripts/devel/command-properties.rst b/doc/src/scripts/devel/command-properties.rst
index 1a6ab11..c7dfd3d 100644
--- a/doc/src/scripts/devel/command-properties.rst
+++ b/doc/src/scripts/devel/command-properties.rst
@@ -234,6 +234,7 @@ Function invocation
Influencing properties:
* ``NAMESPACE`` (namespace_)
+ * ``CONNECTION_TIMEOUT`` (timeout_)
Property descriptions
~~~~~~~~~~~~~~~~~~~~~
@@ -256,11 +257,17 @@ Property descriptions
This usually won't need any modification. Sometimes perhaps associated
function might want to access more than one namespace, in that case an
- instance of :py:class:`lmi.shell.LMIConnection.LMIConnection` might prove more useful.
+ instance of :py:class:`~lmi.shell.LMIConnection.LMIConnection` might prove more useful.
Namespace can also be overriden globally in a configuration file or with
an option on command line.
+.. _timeout:
+
+``CONNECTION_TIMEOUT`` : ``int`` (defaults to ``None``)
+ Specifies maximum number of seconds we should wait for broker's reply. If
+ reached, :py:class:`~lmi.shell.LMIExceptions.ConnectionError` will be
+ raised. The default value is provided by underlying library [#]_.
Output rendering
----------------
@@ -565,6 +572,7 @@ method.
have nothing to do with arguments.
.. [#] Application object is accessible through ``app`` property of each
command instance.
+.. [#] *lmiwbem*'s default timeout is 1 minute as of now.
.. ****************************************************************************