Correct provider default inheritance

We were inheriting the base section of a provider twice, which is
noticeable in the case of lists since they are appended.  This
change corrects that by starting with an empty dictionary.

Change-Id: Iedd54ee817c6bcd6dd32cdf34eb9ba73519eeb57
This commit is contained in:
James E. Blair
2025-09-23 17:12:16 -07:00
parent d899bc615f
commit 7885143646
3 changed files with 7 additions and 2 deletions

View File

@@ -43,6 +43,8 @@
key-name: zuul
volume-type: gp3
volume-size: 10 # winner (all)
security-group-ids:
- sg1
image-defaults:
volume-size: 20
iops: 20

View File

@@ -1491,6 +1491,7 @@ class TestNodepoolConfig(LauncherBaseTestCase):
self.assertEqual('debian-normal', label.name)
self.assertEqual('debian', label.image)
self.assertEqual('normal', label.flavor)
label = layout.labels['debian-large']
self.assertEqual('debian-large', label.name)
self.assertEqual('debian', label.image)
@@ -1523,6 +1524,7 @@ class TestNodepoolConfig(LauncherBaseTestCase):
self.assertEqual(900, label.max_ready_age)
self.assertEqual('required', label.imds_http_tokens)
self.assertFalse(label.host_key_checking)
self.assertEqual(['sg1'], label.security_group_ids)
label = provider.labels['debian-large']
self.assertEqual('gp3', label.volume_type)
@@ -1532,6 +1534,7 @@ class TestNodepoolConfig(LauncherBaseTestCase):
self.assertEqual(300, label.max_ready_age)
self.assertEqual('required', label.imds_http_tokens)
self.assertFalse(label.host_key_checking)
self.assertEqual(['sg1'], label.security_group_ids)
label = provider.labels['debian-local-normal']
self.assertEqual('gp3', label.volume_type)
@@ -1541,6 +1544,7 @@ class TestNodepoolConfig(LauncherBaseTestCase):
self.assertEqual(900, label.max_ready_age)
self.assertEqual('required', label.imds_http_tokens)
self.assertFalse(label.host_key_checking)
self.assertEqual(['sg1'], label.security_group_ids)
@simple_layout('layouts/nodepool-defaults-redefinition.yaml',
enable_nodepool=True)

View File

@@ -2029,8 +2029,7 @@ class ProviderConfig(ConfigObject):
previous_section = parent_section
inheritance_path.reverse()
root = inheritance_path[0]
config = copy.deepcopy(root.config)
config = {}
connection = connections.get(connection_name)
if connection is None:
raise UnknownConnection(connection_name)