Merge "Allow disabling host-key-checking in statemachine"
This commit is contained in:
commit
da7d07e055
@ -218,7 +218,7 @@ class AzurePool(ConfigPool):
|
|||||||
self.use_internal_ip = pool_config.get(
|
self.use_internal_ip = pool_config.get(
|
||||||
'use-internal-ip', self.provider.use_internal_ip)
|
'use-internal-ip', self.provider.use_internal_ip)
|
||||||
self.host_key_checking = pool_config.get(
|
self.host_key_checking = pool_config.get(
|
||||||
'host-key-checking', self.provider.use_internal_ip)
|
'host-key-checking', self.provider.host_key_checking)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def getSchema():
|
def getSchema():
|
||||||
|
@ -122,6 +122,7 @@ class MetastaticInstance(statemachine.Instance):
|
|||||||
self.shell_type = backing_node.shell_type
|
self.shell_type = backing_node.shell_type
|
||||||
self.connection_port = backing_node.connection_port
|
self.connection_port = backing_node.connection_port
|
||||||
self.connection_type = backing_node.connection_type
|
self.connection_type = backing_node.connection_type
|
||||||
|
self.host_keys = backing_node.host_keys
|
||||||
backing_node_id = backing_node.id
|
backing_node_id = backing_node.id
|
||||||
else:
|
else:
|
||||||
backing_node_id = None
|
backing_node_id = None
|
||||||
|
@ -73,6 +73,8 @@ class MetastaticPool(ConfigPool):
|
|||||||
self.labels = {}
|
self.labels = {}
|
||||||
# We will just use the interface_ip of the backing node
|
# We will just use the interface_ip of the backing node
|
||||||
self.use_internal_ip = False
|
self.use_internal_ip = False
|
||||||
|
self.host_key_checking = False
|
||||||
|
|
||||||
self.load(pool_config)
|
self.load(pool_config)
|
||||||
|
|
||||||
def load(self, pool_config):
|
def load(self, pool_config):
|
||||||
|
@ -32,7 +32,7 @@ from kazoo import exceptions as kze
|
|||||||
import cachetools
|
import cachetools
|
||||||
|
|
||||||
|
|
||||||
def keyscan(node_id, interface_ip,
|
def keyscan(host_key_checking, node_id, interface_ip,
|
||||||
connection_type, connection_port,
|
connection_type, connection_port,
|
||||||
timeout):
|
timeout):
|
||||||
"""A standalone function for scanning keys to pass to a thread/process
|
"""A standalone function for scanning keys to pass to a thread/process
|
||||||
@ -40,6 +40,8 @@ def keyscan(node_id, interface_ip,
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
keys = []
|
keys = []
|
||||||
|
if not host_key_checking:
|
||||||
|
return keys
|
||||||
try:
|
try:
|
||||||
if (connection_type == 'ssh' or
|
if (connection_type == 'ssh' or
|
||||||
connection_type == 'network_cli'):
|
connection_type == 'network_cli'):
|
||||||
@ -156,7 +158,8 @@ class StateMachineNodeLauncher(stats.StatsReporter):
|
|||||||
# Optionally, if the node has updated values that we set from
|
# Optionally, if the node has updated values that we set from
|
||||||
# the image attributes earlier, set those.
|
# the image attributes earlier, set those.
|
||||||
for attr in ('username', 'python_path', 'shell_type',
|
for attr in ('username', 'python_path', 'shell_type',
|
||||||
'connection_port', 'connection_type'):
|
'connection_port', 'connection_type',
|
||||||
|
'host_keys'):
|
||||||
if hasattr(instance, attr):
|
if hasattr(instance, attr):
|
||||||
setattr(node, attr, getattr(instance, attr))
|
setattr(node, attr, getattr(instance, attr))
|
||||||
|
|
||||||
@ -175,7 +178,8 @@ class StateMachineNodeLauncher(stats.StatsReporter):
|
|||||||
if (self.state_machine.complete and self.keyscan_future
|
if (self.state_machine.complete and self.keyscan_future
|
||||||
and self.keyscan_future.done()):
|
and self.keyscan_future.done()):
|
||||||
keys = self.keyscan_future.result()
|
keys = self.keyscan_future.result()
|
||||||
node.host_keys = keys
|
if keys:
|
||||||
|
node.host_keys = keys
|
||||||
self.log.debug(f"Node {node.id} is ready")
|
self.log.debug(f"Node {node.id} is ready")
|
||||||
node.state = zk.READY
|
node.state = zk.READY
|
||||||
self.zk.storeNode(node)
|
self.zk.storeNode(node)
|
||||||
@ -206,6 +210,7 @@ class StateMachineNodeLauncher(stats.StatsReporter):
|
|||||||
node.interface_ip)
|
node.interface_ip)
|
||||||
future = self.manager.keyscan_worker.submit(
|
future = self.manager.keyscan_worker.submit(
|
||||||
keyscan,
|
keyscan,
|
||||||
|
self.handler.pool.host_key_checking,
|
||||||
node.id, node.interface_ip,
|
node.id, node.interface_ip,
|
||||||
node.connection_type, node.connection_port,
|
node.connection_type, node.connection_port,
|
||||||
self.manager.provider.boot_timeout)
|
self.manager.provider.boot_timeout)
|
||||||
@ -717,6 +722,7 @@ class Instance:
|
|||||||
* shell_type: str
|
* shell_type: str
|
||||||
* connection_port: str
|
* connection_port: str
|
||||||
* connection_type: str
|
* connection_type: str
|
||||||
|
* host_keys: [str]
|
||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.ready = False
|
self.ready = False
|
||||||
|
Loading…
Reference in New Issue
Block a user