Browse Source

Merge "Refresh instance after adding allocation"

changes/03/794903/1
Zuul 1 week ago
committed by Gerrit Code Review
parent
commit
b2d9f0d80a
2 changed files with 8 additions and 2 deletions
  1. +3
    -0
      tripleo_ansible/ansible_plugins/module_utils/baremetal_deploy.py
  2. +5
    -2
      tripleo_ansible/tests/plugins/module_utils/test_baremetal_deploy.py

+ 3
- 0
tripleo_ansible/ansible_plugins/module_utils/baremetal_deploy.py View File

@ -483,6 +483,9 @@ def check_existing(instances, provisioner, baremetal):
node=request['name']
)
# Refresh the instance after adding the allocation
# See: https://bugs.launchpad.net/tripleo/+bug/1929555
instance = provisioner.show_instance(instance.uuid)
found.append(instance)
return found, not_found, unmanaged


+ 5
- 2
tripleo_ansible/tests/plugins/module_utils/test_baremetal_deploy.py View File

@ -1094,7 +1094,8 @@ class TestCheckExistingInstances(base.TestCase):
self.assertEqual([], not_found)
self.assertEqual([existing], found)
pr.show_instance.assert_called_once_with('server2')
pr.show_instance.assert_has_calls([mock.call('server2'),
mock.call(existing.uuid)])
def test_hostname_mismatch(self):
pr = mock.Mock()
@ -1136,7 +1137,9 @@ class TestCheckExistingInstances(base.TestCase):
self.assertEqual([], not_found)
self.assertEqual([existing], found)
pr.show_instance.assert_called_once_with('bm_node1')
self.assertEqual(2, pr.show_instance.call_count)
pr.show_instance.assert_has_calls([mock.call('bm_node1'),
mock.call(existing.uuid)])
def test_hostname_mismatch_and_instance_info_display_name_mismatch(self):
pr = mock.Mock()


Loading…
Cancel
Save