Support node-attributes in Azure driver

This is intended to be supported by all drivers, but we missed it
in the recent refactor.

Change-Id: Ib3f8c090b06c8458eb2f492db33e77a763aa64d0
This commit is contained in:
James E. Blair 2021-08-23 13:53:30 -07:00
parent 96932c25f9
commit cfb2283b6d
6 changed files with 22 additions and 1 deletions

View File

@ -392,6 +392,12 @@ section of the configuration.
A unique name within the provider for this pool of resources.
.. attr:: node-attributes
:type: dict
A dictionary of key-value pairs that will be stored with the node data
in ZooKeeper. The keys and values can be any arbitrary string.
.. attr:: ipv4
:type: bool

View File

@ -166,6 +166,7 @@ class AzurePool(ConfigPool):
self.load(pool_config)
def load(self, pool_config):
super().load(pool_config)
self.name = pool_config['name']
self.max_servers = pool_config['max-servers']
self.public_ipv4 = pool_config.get('public-ipv4',

View File

@ -35,6 +35,9 @@ providers:
pools:
- name: main
max-servers: 10
node-attributes:
key1: value1
key2: value2
labels:
- name: bionic
diskimage: fake-image

View File

@ -36,6 +36,9 @@ providers:
pools:
- name: main
max-servers: 10
node-attributes:
key1: value1
key2: value2
labels:
- name: bionic
cloud-image: bionic
@ -44,4 +47,4 @@ providers:
tags:
department: R&D
team: DevOps
systemPurpose: CI
systemPurpose: CI

View File

@ -54,6 +54,8 @@ class TestDriverAzure(tests.DBTestCase):
self.assertEqual(node.state, zk.READY)
self.assertIsNotNone(node.launcher)
self.assertEqual(node.connection_type, 'ssh')
self.assertEqual(node.attributes,
{'key1': 'value1', 'key2': 'value2'})
def test_azure_diskimage(self):
configfile = self.setup_config(
@ -83,3 +85,5 @@ class TestDriverAzure(tests.DBTestCase):
self.assertEqual(node.state, zk.READY)
self.assertIsNotNone(node.launcher)
self.assertEqual(node.connection_type, 'ssh')
self.assertEqual(node.attributes,
{'key1': 'value1', 'key2': 'value2'})

View File

@ -0,0 +1,4 @@
---
features:
- |
The node-attributes setting has been added to the Azure driver.