'keys' must be defined for host-key-checking: false
If host-key-checking is set to false the aws driver fails with an UnboundLocalError Change-Id: I91ec292a48e283f9fb8d60b944da8eaf1bec393b
This commit is contained in:
parent
e391572495
commit
ec9a532cdd
@ -230,6 +230,7 @@ class AwsProviderConfig(ProviderConfig):
|
||||
pool.update({
|
||||
v.Required('name'): str,
|
||||
v.Required('labels'): [pool_label],
|
||||
'host-key-checking': bool,
|
||||
'security-group-id': str,
|
||||
'subnet-id': str,
|
||||
})
|
||||
|
@ -80,6 +80,7 @@ class AwsInstanceLauncher(NodeLauncher):
|
||||
|
||||
self.node.connection_port = self.label.cloud_image.connection_port
|
||||
self.node.connection_type = self.label.cloud_image.connection_type
|
||||
keys = []
|
||||
if self.pool.host_key_checking:
|
||||
try:
|
||||
if (self.node.connection_type == 'ssh' or
|
||||
|
11
nodepool/tests/fixtures/aws.yaml
vendored
11
nodepool/tests/fixtures/aws.yaml
vendored
@ -9,6 +9,7 @@ labels:
|
||||
- name: ubuntu1404-by-filters
|
||||
- name: ubuntu1404-by-capitalized-filters
|
||||
- name: ubuntu1404-bad-config
|
||||
- name: ubuntu1404-non-host-key-checking
|
||||
|
||||
providers:
|
||||
- name: ec2-us-west-2
|
||||
@ -66,3 +67,13 @@ providers:
|
||||
cloud-image: ubuntu1404-bad-config
|
||||
instance-type: t3.medium
|
||||
key-name: zuul
|
||||
- name: non-host-key-checking
|
||||
max-servers: 1
|
||||
subnet-id: null
|
||||
security-group-id: null
|
||||
host-key-checking: false
|
||||
labels:
|
||||
- name: ubuntu1404-non-host-key-checking
|
||||
cloud-image: ubuntu1404
|
||||
instance-type: t3.medium
|
||||
key-name: zuul
|
||||
|
@ -63,8 +63,12 @@ class TestDriverAws(tests.DBTestCase):
|
||||
}
|
||||
raw_config['providers'][0]['pools'][0]['subnet-id'] = subnet_id
|
||||
raw_config['providers'][0]['pools'][0]['security-group-id'] = sg_id
|
||||
raw_config['providers'][0]['pools'][1]['subnet-id'] = subnet_id
|
||||
raw_config['providers'][0]['pools'][1]['security-group-id'] = sg_id
|
||||
|
||||
def _test_run_node(label, is_valid_config=True):
|
||||
def _test_run_node(label,
|
||||
is_valid_config=True,
|
||||
host_key_checking=True):
|
||||
with tempfile.NamedTemporaryFile() as tf:
|
||||
tf.write(yaml.safe_dump(
|
||||
raw_config, default_flow_style=False).encode('utf-8'))
|
||||
@ -95,11 +99,12 @@ class TestDriverAws(tests.DBTestCase):
|
||||
self.assertEqual(node.state, zk.READY)
|
||||
self.assertIsNotNone(node.launcher)
|
||||
self.assertEqual(node.connection_type, 'ssh')
|
||||
nodescan.assert_called_with(
|
||||
node.interface_ip,
|
||||
port=22,
|
||||
timeout=180,
|
||||
gather_hostkeys=True)
|
||||
if host_key_checking:
|
||||
nodescan.assert_called_with(
|
||||
node.interface_ip,
|
||||
port=22,
|
||||
timeout=180,
|
||||
gather_hostkeys=True)
|
||||
|
||||
# A new request will be paused and for lack of quota
|
||||
# until this one is deleted
|
||||
@ -136,8 +141,11 @@ class TestDriverAws(tests.DBTestCase):
|
||||
{"label": "ubuntu1404-by-capitalized-filters"},
|
||||
{"label": "ubuntu1404-bad-ami-name", "is_valid_config": False},
|
||||
{"label": "ubuntu1404-bad-config", "is_valid_config": False},
|
||||
{"label": "ubuntu1404-non-host-key-checking",
|
||||
"host_key_checking": False},
|
||||
]
|
||||
|
||||
for cloud_image in cloud_images:
|
||||
_test_run_node(cloud_image["label"],
|
||||
cloud_image.get("is_valid_config"))
|
||||
cloud_image.get("is_valid_config"),
|
||||
cloud_image.get("host_key_checking"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user