static: fix missing python-path update
This change fixes a missing python-path node attribute update for the static node provider. Change-Id: I4a0b8dfd7e134c635acbf52d63e565638565cdbb
This commit is contained in:
parent
e87a1e0ed8
commit
720dcec886
|
@ -166,12 +166,14 @@ class StaticNodeProvider(Provider):
|
|||
static_node["username"],
|
||||
static_node["connection-port"],
|
||||
static_node["connection-type"],
|
||||
static_node["python-path"],
|
||||
host_keys,
|
||||
)
|
||||
|
||||
for node in nodes:
|
||||
original_attrs = (node.type, node.username, node.connection_port,
|
||||
node.connection_type, node.host_keys)
|
||||
node.connection_type, node.python_path,
|
||||
node.host_keys)
|
||||
|
||||
if original_attrs == new_attrs:
|
||||
continue
|
||||
|
@ -182,6 +184,7 @@ class StaticNodeProvider(Provider):
|
|||
node.username = static_node["username"]
|
||||
node.connection_port = static_node["connection-port"]
|
||||
node.connection_type = static_node["connection-type"]
|
||||
node.python_path = static_node["python-path"]
|
||||
nodeutils.set_node_ip(node)
|
||||
node.host_keys = host_keys
|
||||
except exceptions.ZKLockException:
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
zookeeper-servers:
|
||||
- host: {zookeeper_host}
|
||||
port: {zookeeper_port}
|
||||
chroot: {zookeeper_chroot}
|
||||
|
||||
labels:
|
||||
- name: fake-label
|
||||
|
||||
providers:
|
||||
- name: static-provider
|
||||
driver: static
|
||||
pools:
|
||||
- name: main
|
||||
nodes:
|
||||
- name: fake-host-1
|
||||
labels: fake-label
|
||||
host-key: ssh-rsa FAKEKEY
|
||||
timeout: 13
|
||||
connection-port: 22022
|
||||
username: zuul
|
||||
python-path: /usr/bin/python3
|
|
@ -63,6 +63,25 @@ class TestDriverStatic(tests.DBTestCase):
|
|||
self.assertEqual(nodes[0].connection_type, 'ssh')
|
||||
self.assertEqual(nodes[0].host_keys, ['ssh-rsa FAKEKEY'])
|
||||
|
||||
def test_static_python_path(self):
|
||||
'''
|
||||
Test that static python-path works.
|
||||
'''
|
||||
configfile = self.setup_config('static-python-path.yaml')
|
||||
pool = self.useNodepool(configfile, watermark_sleep=1)
|
||||
pool.start()
|
||||
|
||||
self.log.debug("Waiting for node pre-registration")
|
||||
nodes = self.waitForNodes('fake-label')
|
||||
self.assertEqual(nodes[0].python_path, "/usr/bin/python3")
|
||||
|
||||
nodes[0].state = zk.USED
|
||||
self.zk.storeNode(nodes[0])
|
||||
|
||||
self.log.debug("Waiting for node to be re-available")
|
||||
nodes = self.waitForNodes('fake-label')
|
||||
self.assertEqual(nodes[0].python_path, "/usr/bin/python3")
|
||||
|
||||
def test_static_unresolvable(self):
|
||||
'''
|
||||
Test that basic node registration works.
|
||||
|
|
Loading…
Reference in New Issue