Repository :
http://git.fedorahosted.org/cgit/cura-tools.git
On branch : master
---------------------------------------------------------------
commit 70441c7512def4f6661983d671b0f22b9a889a8c
Author: Peter Hatina <phatina(a)redhat.com>
Date: Fri Aug 2 12:18:16 2013 +0200
fix doc strings for (non)interactive connect
---------------------------------------------------------------
cli/lmi/shell/LMIConsole.py | 28 +++++++++++++++++++++++++---
1 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/cli/lmi/shell/LMIConsole.py b/cli/lmi/shell/LMIConsole.py
index cb9f1cd..37058da 100644
--- a/cli/lmi/shell/LMIConsole.py
+++ b/cli/lmi/shell/LMIConsole.py
@@ -33,7 +33,7 @@ from LMIShellConfig import LMIShellConfig
from LMIReturnValue import LMIReturnValue
from LMIObjectFactory import LMIObjectFactory
-from LMIConnection import connect
+from LMIConnection import connect as connect_internal
from LMIUtil import lmi_set_use_exceptions
from LMIUtil import lmi_get_use_exceptions
@@ -133,6 +133,17 @@ class LMIConsole(code.InteractiveConsole):
Arguments:
locals -- dictionary with locals
"""
+ def connect(hostname, username="", password=""):
+ """
+ Returns LMIConnection object with provided hostname and credentials.
+
+ Arguments:
+ hostname -- uri of the CIMOM
+ username -- account, under which, the CIM calls will be performed
+ password -- user's password
+ """
+ return connect_internal(hostname, username, password, True, self._use_cache)
+
# Initialize the interpreter
if locals is None:
locals = {}
@@ -142,7 +153,7 @@ class LMIConsole(code.InteractiveConsole):
locals[k]._client.interactive = True
locals["clear_history"] = self.clear_history
locals["use_display_sugar"] = _use_display_sugar
- locals["connect"] = lambda h, u="", p="":
connect(h, u, p, True, self._use_cache)
+ locals["connect"] = connect
self.locals = dict(self.locals.items() + locals.items())
self.setup_completer()
self.load_history()
@@ -199,6 +210,17 @@ class LMIConsole(code.InteractiveConsole):
script_argv -- script CLI arguments
locals -- dictionary with locals
"""
+ # Helper function for non-interactive connect
+ def connect(hostname, username="", password=""):
+ """
+ Returns LMIConnection object with provided hostname and credentials.
+
+ Arguments:
+ hostname -- uri of the CIMOM
+ username -- account, under which, the CIM calls will be performed
+ password -- user's password
+ """
+ return connect_internal(hostname, username, password, False,
self._use_cache)
# Initialize locals
if locals is None:
locals = {}
@@ -206,7 +228,7 @@ class LMIConsole(code.InteractiveConsole):
for (k, v) in locals.iteritems():
if isinstance(v, LMIConnection):
locals[k]._client.interactive = False
- locals["connect"] = lambda h, u="", p="":
connect(h, u, p, False, self._use_cache)
+ locals["connect"] = connect
self.locals = dict(self.locals.items() + locals.items())
# Execute the script