Skip deployments with no uuid
If a deployment is not triggered for whatever stack operation is in
progress, instead of having a uuid for the deployment value, Heat just
substitutes the resource name of TripleOSoftwareDeployment.
This needs to be handled in the config download code so that we don't
try and query the Heat API for a deployment with that name which will
just result in a 404 Not found.
Change-Id: If4575498387e9dee94a9ebd75353a2a8bf719072
Closes-Bug: #1798439
Upstream-Stein: https://review.openstack.org/#/c/611421/1
(cherry picked from commit f1f96a88a5
)
This commit is contained in:
parent
800e0aaf8f
commit
133eb9ce1f
|
@ -396,3 +396,56 @@ class TestConfig(base.TestCase):
|
|||
self.assertEqual(1, len(w))
|
||||
assert issubclass(w[-1].category, DeprecationWarning)
|
||||
assert "group:os-apply-config is deprecated" in str(w[-1].message)
|
||||
|
||||
@patch('tripleo_common.utils.config.Config.get_config_dict')
|
||||
@patch('tripleo_common.utils.config.Config.get_deployment_data')
|
||||
def test_config_download_no_deployment_uuid(self, mock_deployment_data,
|
||||
mock_config_dict):
|
||||
heat = mock.MagicMock()
|
||||
self.config = ooo_config.Config(heat)
|
||||
stack = mock.MagicMock()
|
||||
heat.stacks.get.return_value = stack
|
||||
stack.outputs = [
|
||||
{'output_key': 'RoleNetHostnameMap',
|
||||
'output_value': {
|
||||
'Controller': {
|
||||
'ctlplane': [
|
||||
'overcloud-controller-0.ctlplane.localdomain']},
|
||||
'Compute': {
|
||||
'ctlplane': [
|
||||
'overcloud-novacompute-0.ctlplane.localdomain',
|
||||
'overcloud-novacompute-1.ctlplane.localdomain',
|
||||
'overcloud-novacompute-2.ctlplane.localdomain']}}},
|
||||
{'output_key': 'ServerIdData',
|
||||
'output_value': {
|
||||
'server_ids': {
|
||||
'Controller': [
|
||||
'00b3a5e1-5e8e-4b55-878b-2fa2271f15ad'],
|
||||
'Compute': [
|
||||
'a7db3010-a51f-4ae0-a791-2364d629d20d',
|
||||
'8b07cd31-3083-4b88-a433-955f72039e2c',
|
||||
'169b46f8-1965-4d90-a7de-f36fb4a830fe']}}},
|
||||
{'output_key': 'RoleGroupVars',
|
||||
'output_value': {
|
||||
'Controller': {
|
||||
'any_errors_fatal': 'yes',
|
||||
'max_fail_percentage': 15},
|
||||
'Compute': {
|
||||
'any_errors_fatal': 'yes',
|
||||
'max_fail_percentage': 15},
|
||||
}}]
|
||||
deployment_data, configs = self._get_config_data('config_data.yaml')
|
||||
|
||||
# Set the deployment to TripleOSoftwareDeployment for the first
|
||||
# deployment
|
||||
deployment_data[0].attributes['value']['deployment'] = \
|
||||
'TripleOSoftwareDeployment'
|
||||
|
||||
self.configs = configs
|
||||
mock_deployment_data.return_value = deployment_data
|
||||
mock_config_dict.side_effect = self._get_config_dict
|
||||
|
||||
self.tmp_dir = self.useFixture(fixtures.TempDir()).path
|
||||
with warnings.catch_warnings(record=True) as w:
|
||||
self.config.download_config(stack, self.tmp_dir)
|
||||
assert "Skipping deployment" in str(w[-1].message)
|
||||
|
|
|
@ -215,6 +215,21 @@ class Config(object):
|
|||
server_roles = {}
|
||||
|
||||
for deployment in deployments_data:
|
||||
# Check if the deployment value is the resource name. If that's the
|
||||
# case, Heat did not create a physical_resource_id for this
|
||||
# deployment since it does not trigger on this stack action. Such
|
||||
# as a deployment that only triggers on DELETE, but this is a stack
|
||||
# create. If that's the case, just skip this deployment, otherwise
|
||||
# it will result in a Not found error if we try and query the
|
||||
# deployment API for this deployment.
|
||||
if deployment.attributes['value'].get('deployment') == \
|
||||
'TripleOSoftwareDeployment':
|
||||
warnings.warn('Skipping deployment %s because it has no '
|
||||
'valid uuid (physical_resource_id) '
|
||||
'associated.' %
|
||||
deployment.physical_resource_id)
|
||||
continue
|
||||
|
||||
server_id = deployment.attributes['value']['server']
|
||||
config_dict = self.get_config_dict(deployment)
|
||||
|
||||
|
|
Loading…
Reference in New Issue