Improve static provider to check non-ssh hosts
This behavior is now in line with how the OpenStack driver is checking hosts with a non-ssh connection type. Change-Id: Ica553430d1d64fe69f5a8ccc9d4b453c7f21dac8
This commit is contained in:
parent
a54e4bf0dc
commit
55e70f7636
|
@ -36,18 +36,22 @@ class StaticNodeProvider(Provider):
|
|||
self.static_nodes = {}
|
||||
|
||||
def checkHost(self, node):
|
||||
# Check node is reachable
|
||||
if node["connection-type"] != "ssh":
|
||||
return
|
||||
'''Check node is reachable'''
|
||||
# only gather host keys if the connection type is ssh
|
||||
gather_hostkeys = node["connection-type"] == 'ssh'
|
||||
try:
|
||||
keys = nodeutils.nodescan(node["name"],
|
||||
port=node["connection-port"],
|
||||
timeout=node["timeout"])
|
||||
timeout=node["timeout"],
|
||||
gather_hostkeys=gather_hostkeys)
|
||||
except exceptions.ConnectionTimeoutException:
|
||||
raise StaticNodeError(
|
||||
"%s:%s: ConnectionTimeoutException" % (
|
||||
node["name"], node["connection-port"]))
|
||||
|
||||
if not gather_hostkeys:
|
||||
return
|
||||
|
||||
# Check node host-key
|
||||
if set(node["host-key"]).issubset(set(keys)):
|
||||
return keys
|
||||
|
|
Loading…
Reference in New Issue