Repository : http://git.fedorahosted.org/cgit/cura-tools.git
On branch : master
commit 301222959f71e1179bfd91426888e5a50cfb2dc4 Author: Peter Hatina phatina@redhat.com Date: Thu Oct 17 16:05:38 2013 +0200
rename hostname members to uri
cli/lmi/shell/LMIBaseClient.py | 16 ++++++++-------- cli/lmi/shell/LMIConnection.py | 28 ++++++++++++++-------------- cli/lmi/shell/LMIConsole.py | 12 ++++++------ cli/lmi/shell/LMIMethod.py | 4 ++-- cli/lmi/shell/LMIShellClient.py | 6 +++--- 5 files changed, 33 insertions(+), 33 deletions(-)
diff --git a/cli/lmi/shell/LMIBaseClient.py b/cli/lmi/shell/LMIBaseClient.py index 3dafed1..745e487 100644 --- a/cli/lmi/shell/LMIBaseClient.py +++ b/cli/lmi/shell/LMIBaseClient.py @@ -26,7 +26,7 @@ class LMIBaseClient(object): Base client class for CIMOM communication. It abstracts the :py:mod:`pywbem` dependent calls to :py:class:`LMIBaseClient` API.
- :param string hostname: URI of the CIMOM + :param string uri: URI of the CIMOM :param string username: account, under which, the CIM calls will be performed :param string password: user's password :param conn_type: type of connection; can be of 2 values: @@ -46,7 +46,7 @@ class LMIBaseClient(object): CONN_TYPE_WBEM, \ CONN_TYPE_PEGASUS_UDS = range(2)
- def __init__(self, hostname, username="", password="", **kwargs): + def __init__(self, uri, username="", password="", **kwargs): def verify_callback(conn, cert, errno, errdepth, rcode): """ Callback function used to verify the server certificate. It is passed to @@ -72,14 +72,14 @@ class LMIBaseClient(object): if kwargs: raise TypeError("__init__() got an unexpected keyword arguments: %s" % ", ".join(kwargs.keys()))
- self._hostname = hostname + self._uri = uri self._username = username - if not self._hostname.startswith("http://") and not self._hostname.startswith("https://"): - self._hostname= "https://" + self._hostname + if not self._uri.startswith("http://") and not self._uri.startswith("https://"): + self._uri= "https://" + self._uri if conn_type == LMIBaseClient.CONN_TYPE_PEGASUS_UDS: self._cliconn = pywbem.PegasusUDSConnection() else: - self._cliconn = pywbem.WBEMConnection(self._hostname, + self._cliconn = pywbem.WBEMConnection(self._uri, (self._username, password), x509={"key_file" : key_file, "cert_file" : cert_file}, verify_callback=verify_callback if verify_server_cert else None @@ -662,9 +662,9 @@ class LMIBaseClient(object): return self._username
@property - def hostname(self): + def uri(self): """ :returns: URI of the CIMOM :rtype: string """ - return self._hostname + return self._uri diff --git a/cli/lmi/shell/LMIConnection.py b/cli/lmi/shell/LMIConnection.py index 563a4fa..d14ce92 100644 --- a/cli/lmi/shell/LMIConnection.py +++ b/cli/lmi/shell/LMIConnection.py @@ -82,11 +82,11 @@ def __lmi_raw_input(prompt, use_echo=True):
return result
-def connect(hostname, username="", password="", **kwargs): +def connect(uri, username="", password="", **kwargs): """ Creates a connection object with provided URI and credentials.
- :param string hostname: URI of the CIMOM + :param string uri: URI of the CIMOM :param string username: account, under which, the CIM calls will be performed :param string password: user's password
@@ -127,12 +127,12 @@ def connect(hostname, username="", password="", **kwargs): raise TypeError("connect() got an unexpected keyword arguments: %s" % ", ".join(kwargs.keys()))
connection = None - netloc = urlparse.urlparse(hostname).netloc - destination = netloc if netloc else hostname + netloc = urlparse.urlparse(uri).netloc + destination = netloc if netloc else uri if os.getuid() == 0 and destination in ("localhost", "127.0.0.1", "::1") and \ os.path.exists("/var/run/tog-pegasus/cimxml.socket") and \ not username and not password: - connection = LMIConnection(hostname, None, None, interactive=interactive, + connection = LMIConnection(uri, None, None, interactive=interactive, use_cache=use_cache, conn_type=LMIBaseClient.CONN_TYPE_PEGASUS_UDS, verify_server_cert=verify_server_cert) if not connection.verify_credentials(): @@ -147,7 +147,7 @@ def connect(hostname, username="", password="", **kwargs): except KeyboardInterrupt, e: sys.stdout.write("\n") return None - connection = LMIConnection(hostname, username, password, interactive=interactive, + connection = LMIConnection(uri, username, password, interactive=interactive, use_cache=use_cache, conn_type=LMIBaseClient.CONN_TYPE_WBEM, key_file=key_file, cert_file=cert_file, verify_server_cert=verify_server_cert) if not connection.verify_credentials(): @@ -160,7 +160,7 @@ class LMIConnection(object): should have its own connection object created. This class provides an entry point to the namespace/classes/instances/methods hierarchy present in the LMIShell.
- :param string hostname: URI of the CIMOM + :param string uri: URI of the CIMOM :param string username: account, under which, the CIM calls will be performed :param string password: user's password :param bool interactive: flag indicating, if the LMIShell client is running @@ -187,7 +187,7 @@ class LMIConnection(object): * use pager for the output of: :py:meth:`.LMIInstance.doc`, :py:meth:`.LMIClass.doc`, :py:meth:`.LMIInstance.tomof` and :py:meth:`.LMIMethod.tomof` """ - def __init__(self, hostname, username="", password="", **kwargs): + def __init__(self, uri, username="", password="", **kwargs): # Set remaining arguments interactive = kwargs.pop("interactive", False) use_cache = kwargs.pop("use_cache", True) @@ -198,7 +198,7 @@ class LMIConnection(object): if kwargs: raise TypeError("__init__() got an unexpected keyword arguments: %s" % ", ".join(kwargs.keys()))
- self._client = LMIShellClient(hostname, username, password, interactive=interactive, + self._client = LMIShellClient(uri, username, password, interactive=interactive, use_cache=use_cache, conn_type=conn_type, key_file=key_file, cert_file=cert_file, verify_server_cert=verify_server_cert) self._indications = {} @@ -210,15 +210,15 @@ class LMIConnection(object): :returns: pretty string for the object. """ return "%s(URI='%s', user='%s'...)" % (self.__class__.__name__, - self._client.hostname, self._client.username) + self._client.uri, self._client.username)
@property - def hostname(self): + def uri(self): """ :returns: URI of the CIMOM :rtype: string """ - return self._client.hostname + return self._client.uri
@property def namespaces(self): @@ -361,7 +361,7 @@ class LMIConnection(object): "CreationClassName" : kwargs["FilterCreationClassName"], "SystemCreationClassName" : kwargs["FilterSystemCreationClassName"], "SourceNamespace" : kwargs["FilterSourceNamespace"], - "SystemName" : self._client.hostname, + "SystemName" : self._client.uri, "Query" : kwargs["Query"], "QueryLanguage" : kwargs["QueryLanguage"], "Name" : kwargs["Name"] + "-filter" @@ -379,7 +379,7 @@ class LMIConnection(object): cim_handler_props = { "CreationClassName" : kwargs["HandlerCreationClassName"], "SystemCreationClassName" : kwargs["HandlerSystemCreationClassName"], - "SystemName" : self._client.hostname, + "SystemName" : self._client.uri, "Destination" : kwargs["Destination"] + "/" + kwargs["Name"], "Name" : kwargs["Name"] + "-handler" } diff --git a/cli/lmi/shell/LMIConsole.py b/cli/lmi/shell/LMIConsole.py index f4e5d94..21238e2 100644 --- a/cli/lmi/shell/LMIConsole.py +++ b/cli/lmi/shell/LMIConsole.py @@ -104,12 +104,12 @@ class LMIConsole(code.InteractiveConsole):
:param dictionary locals: locals """ - def connect(hostname, username="", password="", **kwargs): + def connect(uri, username="", password="", **kwargs): """ Returns :py:class:`LMIConnection` object with provided URI and credentials.
- :param string hostname: URI of the CIMOM + :param string uri: URI of the CIMOM :param string username: account, under which, the CIM calls will be performed :param string password: user's password :param dictionary kwargs: supported keyword arguments @@ -128,7 +128,7 @@ class LMIConsole(code.InteractiveConsole): if kwargs: raise TypeError("connect() got an unexpected keyword arguments: %s" % ", ".join(kwargs.keys()))
- return connect_internal(hostname, username, password, interactive=True, + return connect_internal(uri, username, password, interactive=True, use_cache=self._use_cache, key_file=key_file, cert_file=cert_file, verify_server_cert=verify_server_cert)
@@ -199,11 +199,11 @@ class LMIConsole(code.InteractiveConsole): :rtype: int """ # Helper function for non-interactive connect - def connect(hostname, username="", password="", **kwargs): + def connect(uri, username="", password="", **kwargs): """ Returns :py:class:`LMIConnection` object with provided URI and credentials.
- :param string hostname: URI of the CIMOM + :param string uri: URI of the CIMOM :param string username: account, under which, the CIM calls will be performed :param string password: user's password :param dictionary kwargs: supported keyword arguments @@ -223,7 +223,7 @@ class LMIConsole(code.InteractiveConsole): if kwargs: raise TypeError("connect() got an unexpected keyword arguments: %s" % ", ".join(kwargs.keys()))
- return connect_internal(hostname, username, password, interactive=False, + return connect_internal(uri, username, password, interactive=False, use_cache=self._use_cache, key_file=key_file, cert_file=cert_file, verify_server_cert=verify_server_cert) # Initialize locals diff --git a/cli/lmi/shell/LMIMethod.py b/cli/lmi/shell/LMIMethod.py index 098887d..ea97ae0 100644 --- a/cli/lmi/shell/LMIMethod.py +++ b/cli/lmi/shell/LMIMethod.py @@ -278,10 +278,10 @@ class LMIMethod(LMIWrapperBaseObject): cim_filter = cim_filters[0]
# Create handler object - netloc = urlparse.urlparse(self._conn.hostname).netloc + netloc = urlparse.urlparse(self._conn.uri).netloc if not netloc: listener.stop() - errorstr = "Can not determine netloc from client's hostname" + errorstr = "Can not determine netloc from client's uri" raise LMISynchroMethodCallError(errorstr) netloc = netloc.split(":")[0] # NOTE: This will work only on a local area network. Complicated networks may require diff --git a/cli/lmi/shell/LMIShellClient.py b/cli/lmi/shell/LMIShellClient.py index a09b270..6c246f0 100644 --- a/cli/lmi/shell/LMIShellClient.py +++ b/cli/lmi/shell/LMIShellClient.py @@ -21,7 +21,7 @@ class LMIShellClient(LMIBaseClient): """ :class:`LMIShellClient` overrides few methods due to caching purposes.
- :param string hostname: URI of the CIMOM + :param string uri: URI of the CIMOM :param string username: account, under which, the CIM calls will be performed :param string password: user's password :param bool interactive: flag indicating, if the LMIShell client is running in the @@ -50,7 +50,7 @@ class LMIShellClient(LMIBaseClient): :py:meth:`.LMIClass.doc`, :py:meth:`.LMIInstance.tomof` and :py:meth:`.LMIMethod.tomof` """ - def __init__(self, hostname, username="", password="", **kwargs): + def __init__(self, uri, username="", password="", **kwargs): # Set remaining arguments interactive = kwargs.pop("interactive", False) use_cache = kwargs.pop("use_cache", True) @@ -61,7 +61,7 @@ class LMIShellClient(LMIBaseClient): if kwargs: raise TypeError("__init__() got an unexpected keyword arguments: %s" % ", ".join(kwargs.keys()))
- super(LMIShellClient, self).__init__(hostname, username, password, conn_type=conn_type, + super(LMIShellClient, self).__init__(uri, username, password, conn_type=conn_type, key_file=key_file, cert_file=cert_file, verify_server_cert=verify_server_cert) self._interactive = interactive self._cache = LMIShellCache(use_cache)
cura-tools-devel@lists.fedorahosted.org