Repository :
http://git.fedorahosted.org/cgit/cura-tools.git
On branch : master
---------------------------------------------------------------
commit dfd153f6949d0002cafa6b5a31e0413a4d5833cd
Author: Michal Minar <miminar(a)redhat.com>
Date: Mon Dec 15 10:14:08 2014 +0100
scripts: support older LMIShell
LMIConnection in older openlmi-tools (currently shipped in RHEL7) does
not have client property. Support both older and newer interface.
---------------------------------------------------------------
cli/lmi/scripts/common/session.py | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/cli/lmi/scripts/common/session.py b/cli/lmi/scripts/common/session.py
index 8d2ad7e..9e892f4 100644
--- a/cli/lmi/scripts/common/session.py
+++ b/cli/lmi/scripts/common/session.py
@@ -107,8 +107,14 @@ class Session(object):
kwargs['prompt_prefix'] = '[%s] ' % hostname
connection = connect(hostname, username, password, **kwargs)
if connection is not None:
- tp = connection.client._cliconn.creds
- if tp is None:
+ client = None
+ if hasattr(connection, "client"):
+ client = connection.client
+ elif hasattr(connection, "_client"):
+ client = connection._client
+ if client is not None:
+ tp = client._cliconn.creds
+ if client is None or tp is None:
tp = ('', '')
self._credentials[hostname] = (tp[0], tp[1], True)
else: