Convert exceptions to strings when passing them to the Result class
The Mistral Result class expects the error property to be either a string or a dict. Other types, like exceptions, can cause errors in mistral which in turn cause a critical failure. See the Mistral bug report: https://bugs.launchpad.net/mistral/+bug/1645295 This change also updates one use of the Result class that doesn't use kwargs. Change-Id: Ia93f298e5181bae92d7a08468d33c255d38b996a Closes-Bug: #1645296
This commit is contained in:
parent
540a80a715
commit
0aee2ceb3c
@ -17,6 +17,7 @@ import logging
|
||||
import ironic_inspector_client
|
||||
from mistral.workflow import utils as mistral_workflow_utils
|
||||
from oslo_utils import units
|
||||
import six
|
||||
|
||||
from tripleo_common.actions import base
|
||||
from tripleo_common import exception
|
||||
@ -67,7 +68,7 @@ class RegisterOrUpdateNodes(base.TripleOAction):
|
||||
ramdisk_name=self.ramdisk_name)
|
||||
except Exception as err:
|
||||
LOG.exception("Error registering nodes with ironic.")
|
||||
return mistral_workflow_utils.Result(error=err)
|
||||
return mistral_workflow_utils.Result(error=six.text_type(err))
|
||||
|
||||
|
||||
class ConfigureBootAction(base.TripleOAction):
|
||||
@ -130,7 +131,7 @@ class ConfigureBootAction(base.TripleOAction):
|
||||
LOG.debug("Configuring boot option for Node %s", self.node_uuid)
|
||||
except Exception as err:
|
||||
LOG.exception("Error configuring node boot options with Ironic.")
|
||||
return mistral_workflow_utils.Result(error=err)
|
||||
return mistral_workflow_utils.Result(error=six.text_type(err))
|
||||
|
||||
|
||||
class ConfigureRootDeviceAction(base.TripleOAction):
|
||||
|
@ -153,7 +153,7 @@ class GeneratePasswordsAction(base.TripleOAction):
|
||||
except Exception:
|
||||
msg = "Error retrieving mistral environment: %s" % self.container
|
||||
LOG.exception(msg)
|
||||
return mistral_workflow_utils.Result("", msg)
|
||||
return mistral_workflow_utils.Result(error=msg)
|
||||
|
||||
try:
|
||||
stack_env = orchestration.stacks.environment(
|
||||
|
Loading…
Reference in New Issue
Block a user