From bcaa2647121b2aa2c9a36c7f1f88824bd7b7cfe8 Mon Sep 17 00:00:00 2001 From: Tobias Henkel Date: Wed, 9 Jan 2019 14:08:07 +0100 Subject: [PATCH] Default host_keys to empty list in static driver Everywhere in nodepool we default the host_keys to an empty list and zuul relies on this behavior. However the static driver sets this to None for non-ssh connections. Change this to return an empty list to match the behavior of the other drivers. Change-Id: I3f14803c35a2039d2c53f4939857a531ce900097 --- nodepool/driver/static/provider.py | 2 +- nodepool/tests/unit/test_driver_static.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nodepool/driver/static/provider.py b/nodepool/driver/static/provider.py index fd1c94450..a256bd5b0 100644 --- a/nodepool/driver/static/provider.py +++ b/nodepool/driver/static/provider.py @@ -49,7 +49,7 @@ class StaticNodeProvider(Provider): node["name"], node["connection-port"])) if not gather_hostkeys: - return + return [] # Check node host-key if set(node["host-key"]).issubset(set(keys)): diff --git a/nodepool/tests/unit/test_driver_static.py b/nodepool/tests/unit/test_driver_static.py index c36c795d6..88b715d94 100644 --- a/nodepool/tests/unit/test_driver_static.py +++ b/nodepool/tests/unit/test_driver_static.py @@ -177,7 +177,7 @@ class TestDriverStatic(tests.DBTestCase): self.assertEqual(nodes[0].username, 'admin') self.assertEqual(nodes[0].connection_port, 5986) self.assertEqual(nodes[0].connection_type, 'winrm') - self.assertEqual(nodes[0].host_keys, None) + self.assertEqual(nodes[0].host_keys, []) def test_static_multilabel(self): configfile = self.setup_config('static-multilabel.yaml')