cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject git commit: updated refs/heads/master to 433d583
Date Mon, 09 Sep 2013 06:13:54 GMT
Updated Branches:
  refs/heads/master b11a8e12e -> 433d5839a


CLOUDSTACK-4608: Resolve the hostname to fqdn from marvin config

In case the marvin configuration does not contain fqdn information fetch
and compare the fqdns of hostip from `cloud`.`host` with the fqdn
available on the client.

Signed-off-by: Prasanna Santhanam <tsp@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/433d5839
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/433d5839
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/433d5839

Branch: refs/heads/master
Commit: 433d5839a196dd4a8ecc49abc192c580d79c175d
Parents: b11a8e1
Author: Prasanna Santhanam <tsp@apache.org>
Authored: Mon Sep 9 11:41:13 2013 +0530
Committer: Prasanna Santhanam <tsp@apache.org>
Committed: Mon Sep 9 11:41:13 2013 +0530

----------------------------------------------------------------------
 tools/marvin/marvin/integration/lib/utils.py | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/433d5839/tools/marvin/marvin/integration/lib/utils.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/utils.py b/tools/marvin/marvin/integration/lib/utils.py
index c2403d4f..a6abe06 100644
--- a/tools/marvin/marvin/integration/lib/utils.py
+++ b/tools/marvin/marvin/integration/lib/utils.py
@@ -25,6 +25,8 @@ import string
 import random
 import imaplib
 import email
+import socket
+import urlparse
 import datetime
 from marvin.cloudstackAPI import *
 from marvin.remoteSSHClient import remoteSSHClient
@@ -154,16 +156,23 @@ def fetch_api_client(config_file='datacenterCfg'):
         )
     )
 
-def get_host_credentials(config, hostname):
-    """Get login information for a host `hostname` from marvin's `config`
+def get_host_credentials(config, hostip):
+    """Get login information for a host `hostip` (ipv4) from marvin's `config`
 
     @return the tuple username, password for the host else raise keyerror"""
     for zone in config.zones:
         for pod in zone.pods:
             for cluster in pod.clusters:
                 for host in cluster.hosts:
-                    if str(host.url).find(str(hostname)) > 0:
-                        return host.username, host.password
+                    if str(host.url).startswith('http'):
+                        hostname = urlparse.urlsplit(str(host.url)).netloc
+                    else:
+                        hostname = str(host.url)
+                    try:
+                        if socket.getfqdn(hostip) == socket.getfqdn(hostname):
+                            return host.username, host.password
+                    except socket.error, e:
+                        raise Exception("Unresolvable host %s error is %s" % (hostip, e))
     raise KeyError("Please provide the marvin configuration file with credentials to your
hosts")
 
 


Mime
View raw message