diff --git a/nodepool/driver/azure/config.py b/nodepool/driver/azure/config.py index 10a9e6b1b..fc22f2516 100644 --- a/nodepool/driver/azure/config.py +++ b/nodepool/driver/azure/config.py @@ -218,7 +218,7 @@ class AzurePool(ConfigPool): self.use_internal_ip = pool_config.get( 'use-internal-ip', self.provider.use_internal_ip) self.host_key_checking = pool_config.get( - 'host-key-checking', self.provider.use_internal_ip) + 'host-key-checking', self.provider.host_key_checking) @staticmethod def getSchema(): diff --git a/nodepool/driver/metastatic/adapter.py b/nodepool/driver/metastatic/adapter.py index 9dc7fa324..2e87b73b3 100644 --- a/nodepool/driver/metastatic/adapter.py +++ b/nodepool/driver/metastatic/adapter.py @@ -122,6 +122,7 @@ class MetastaticInstance(statemachine.Instance): self.shell_type = backing_node.shell_type self.connection_port = backing_node.connection_port self.connection_type = backing_node.connection_type + self.host_keys = backing_node.host_keys backing_node_id = backing_node.id else: backing_node_id = None diff --git a/nodepool/driver/metastatic/config.py b/nodepool/driver/metastatic/config.py index ccaac83c3..443db4d84 100644 --- a/nodepool/driver/metastatic/config.py +++ b/nodepool/driver/metastatic/config.py @@ -73,6 +73,8 @@ class MetastaticPool(ConfigPool): self.labels = {} # We will just use the interface_ip of the backing node self.use_internal_ip = False + self.host_key_checking = False + self.load(pool_config) def load(self, pool_config): diff --git a/nodepool/driver/statemachine.py b/nodepool/driver/statemachine.py index 58fad0140..af9886279 100644 --- a/nodepool/driver/statemachine.py +++ b/nodepool/driver/statemachine.py @@ -32,7 +32,7 @@ from kazoo import exceptions as kze import cachetools -def keyscan(node_id, interface_ip, +def keyscan(host_key_checking, node_id, interface_ip, connection_type, connection_port, timeout): """A standalone function for scanning keys to pass to a thread/process @@ -40,6 +40,8 @@ def keyscan(node_id, interface_ip, """ keys = [] + if not host_key_checking: + return keys try: if (connection_type == 'ssh' or connection_type == 'network_cli'): @@ -156,7 +158,8 @@ class StateMachineNodeLauncher(stats.StatsReporter): # Optionally, if the node has updated values that we set from # the image attributes earlier, set those. for attr in ('username', 'python_path', 'shell_type', - 'connection_port', 'connection_type'): + 'connection_port', 'connection_type', + 'host_keys'): if hasattr(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 and self.keyscan_future.done()): keys = self.keyscan_future.result() - node.host_keys = keys + if keys: + node.host_keys = keys self.log.debug(f"Node {node.id} is ready") node.state = zk.READY self.zk.storeNode(node) @@ -206,6 +210,7 @@ class StateMachineNodeLauncher(stats.StatsReporter): node.interface_ip) future = self.manager.keyscan_worker.submit( keyscan, + self.handler.pool.host_key_checking, node.id, node.interface_ip, node.connection_type, node.connection_port, self.manager.provider.boot_timeout) @@ -717,6 +722,7 @@ class Instance: * shell_type: str * connection_port: str * connection_type: str + * host_keys: [str] """ def __init__(self): self.ready = False