use Result from mistral_lib instead of mistral

This is part of the ongoing change to remove the mistral
dependency from tripleo-common and use mistral_lib instead

In order to do that we are using the Result class from mistral_lib

Change-Id: I59ce8c6d68de9e9719d84cbaa82462fbd8d647e2
Depends-on: Icc0036bae3c969112f2f67c4a8264bae18f3cc73
This commit is contained in:
Adriano Petrich 2017-04-07 14:24:48 +01:00
parent 4ba7d564db
commit 76b3e025b7
17 changed files with 115 additions and 118 deletions

View File

@ -15,7 +15,7 @@
import logging import logging
import ironic_inspector_client import ironic_inspector_client
from mistral.workflow import utils as mistral_workflow_utils from mistral_lib import actions
from oslo_utils import units from oslo_utils import units
import six import six
@ -68,7 +68,7 @@ class RegisterOrUpdateNodes(base.TripleOAction):
ramdisk_name=self.ramdisk_name) ramdisk_name=self.ramdisk_name)
except Exception as err: except Exception as err:
LOG.exception("Error registering nodes with ironic.") LOG.exception("Error registering nodes with ironic.")
return mistral_workflow_utils.Result(error=six.text_type(err)) return actions.Result(error=six.text_type(err))
class ValidateNodes(base.TripleOAction): class ValidateNodes(base.TripleOAction):
@ -86,10 +86,10 @@ class ValidateNodes(base.TripleOAction):
nodes.validate_nodes(self.nodes_json) nodes.validate_nodes(self.nodes_json)
except exception.InvalidNode as err: except exception.InvalidNode as err:
LOG.error("Validation of nodes failed: %s", err) LOG.error("Validation of nodes failed: %s", err)
return mistral_workflow_utils.Result(error=str(err)) return actions.Result(error=str(err))
except Exception as err: except Exception as err:
LOG.exception("Unexpected exception during node validation") LOG.exception("Unexpected exception during node validation")
return mistral_workflow_utils.Result(error=str(err)) return actions.Result(error=str(err))
class ConfigureBootAction(base.TripleOAction): class ConfigureBootAction(base.TripleOAction):
@ -152,7 +152,7 @@ class ConfigureBootAction(base.TripleOAction):
LOG.debug("Configuring boot option for Node %s", self.node_uuid) LOG.debug("Configuring boot option for Node %s", self.node_uuid)
except Exception as err: except Exception as err:
LOG.exception("Error configuring node boot options with Ironic.") LOG.exception("Error configuring node boot options with Ironic.")
return mistral_workflow_utils.Result(error=six.text_type(err)) return actions.Result(error=six.text_type(err))
class ConfigureRootDeviceAction(base.TripleOAction): class ConfigureRootDeviceAction(base.TripleOAction):
@ -310,7 +310,7 @@ class UpdateNodeCapability(base.TripleOAction):
) )
except Exception as err: except Exception as err:
LOG.exception("Error updating node capability in ironic.") LOG.exception("Error updating node capability in ironic.")
return mistral_workflow_utils.Result( return actions.Result(
error="%s: %s" % (type(err).__name__, str(err)) error="%s: %s" % (type(err).__name__, str(err))
) )
@ -332,7 +332,7 @@ class CellV2DiscoverHostsAction(base.TripleOAction):
) )
except Exception as err: except Exception as err:
LOG.exception("Error running cell_v2 discover_hosts") LOG.exception("Error running cell_v2 discover_hosts")
return mistral_workflow_utils.Result( return actions.Result(
error="%s: %s" % (type(err).__name__, str(err)) error="%s: %s" % (type(err).__name__, str(err))
) )

View File

@ -18,7 +18,7 @@ import time
from heatclient.common import deployment_utils from heatclient.common import deployment_utils
from heatclient import exc as heat_exc from heatclient import exc as heat_exc
from mistral.workflow import utils as mistral_workflow_utils from mistral_lib import actions
from swiftclient import exceptions as swiftexceptions from swiftclient import exceptions as swiftexceptions
from tripleo_common.actions import base from tripleo_common.actions import base
@ -122,7 +122,7 @@ class OrchestrationDeployAction(base.TripleOAction):
if body_json['deploy_status_code'] != 0: if body_json['deploy_status_code'] != 0:
error = "Heat deployment failed for '%s'" % self.name error = "Heat deployment failed for '%s'" % self.name
return mistral_workflow_utils.Result(data=body_json, error=error) return actions.Result(data=body_json, error=error)
class DeployStackAction(templates.ProcessTemplatesAction): class DeployStackAction(templates.ProcessTemplatesAction):
@ -159,7 +159,7 @@ class DeployStackAction(templates.ProcessTemplatesAction):
err_msg = ("Error retrieving environment for plan %s: %s" % ( err_msg = ("Error retrieving environment for plan %s: %s" % (
self.container, err)) self.container, err))
LOG.exception(err_msg) LOG.exception(err_msg)
return mistral_workflow_utils.Result(error=err_msg) return actions.Result(error=err_msg)
try: try:
plan_utils.update_in_env(swift, env, 'parameter_defaults', plan_utils.update_in_env(swift, env, 'parameter_defaults',
@ -168,14 +168,14 @@ class DeployStackAction(templates.ProcessTemplatesAction):
err_msg = ("Error updating environment for plan %s: %s" % ( err_msg = ("Error updating environment for plan %s: %s" % (
self.container, err)) self.container, err))
LOG.exception(err_msg) LOG.exception(err_msg)
return mistral_workflow_utils.Result(error=err_msg) return actions.Result(error=err_msg)
# process all plan files and create or update a stack # process all plan files and create or update a stack
processed_data = super(DeployStackAction, self).run(context) processed_data = super(DeployStackAction, self).run(context)
# If we receive a 'Result' instance it is because the parent action # If we receive a 'Result' instance it is because the parent action
# had an error. # had an error.
if isinstance(processed_data, mistral_workflow_utils.Result): if isinstance(processed_data, actions.Result):
return processed_data return processed_data
stack_args = processed_data.copy() stack_args = processed_data.copy()
@ -224,7 +224,7 @@ class OvercloudRcAction(base.TripleOAction):
error = ( error = (
"The Heat stack {} could not be found. Make sure you have " "The Heat stack {} could not be found. Make sure you have "
"deployed before calling this action.").format(self.container) "deployed before calling this action.").format(self.container)
return mistral_workflow_utils.Result(error=error) return actions.Result(error=error)
# We need to check parameter_defaults first for a user provided # We need to check parameter_defaults first for a user provided
# password. If that doesn't exist, we then should look in the # password. If that doesn't exist, we then should look in the
@ -237,7 +237,7 @@ class OvercloudRcAction(base.TripleOAction):
err_msg = ("Error retrieving environment for plan %s: %s" % ( err_msg = ("Error retrieving environment for plan %s: %s" % (
self.container, err)) self.container, err))
LOG.error(err_msg) LOG.error(err_msg)
return mistral_workflow_utils.Result(error=err_msg) return actions.Result(error=err_msg)
try: try:
parameter_defaults = env['parameter_defaults'] parameter_defaults = env['parameter_defaults']
@ -248,6 +248,6 @@ class OvercloudRcAction(base.TripleOAction):
except KeyError: except KeyError:
error = ("Unable to find the AdminPassword in the plan " error = ("Unable to find the AdminPassword in the plan "
"environment.") "environment.")
return mistral_workflow_utils.Result(error=error) return actions.Result(error=error)
return overcloudrc.create_overcloudrc(stack, self.no_proxy, admin_pass) return overcloudrc.create_overcloudrc(stack, self.no_proxy, admin_pass)

View File

@ -16,7 +16,7 @@ import fnmatch
import logging import logging
import yaml import yaml
from mistral.workflow import utils as mistral_workflow_utils from mistral_lib import actions
from swiftclient import exceptions as swiftexceptions from swiftclient import exceptions as swiftexceptions
from tripleo_common.actions import base from tripleo_common.actions import base
@ -50,7 +50,7 @@ class GetCapabilitiesAction(base.TripleOAction):
err_msg = ( err_msg = (
"Error parsing capabilities-map.yaml.") "Error parsing capabilities-map.yaml.")
LOG.exception(err_msg) LOG.exception(err_msg)
return mistral_workflow_utils.Result(error=err_msg) return actions.Result(error=err_msg)
try: try:
container_files = swift.get_container(self.container) container_files = swift.get_container(self.container)
container_file_list = [entry['name'] for entry container_file_list = [entry['name'] for entry
@ -58,7 +58,7 @@ class GetCapabilitiesAction(base.TripleOAction):
except Exception as swift_err: except Exception as swift_err:
err_msg = ("Error retrieving plan files: %s" % swift_err) err_msg = ("Error retrieving plan files: %s" % swift_err)
LOG.exception(err_msg) LOG.exception(err_msg)
return mistral_workflow_utils.Result(error=err_msg) return actions.Result(error=err_msg)
try: try:
env = plan_utils.get_env(swift, self.container) env = plan_utils.get_env(swift, self.container)
@ -66,7 +66,7 @@ class GetCapabilitiesAction(base.TripleOAction):
err_msg = ("Error retrieving environment for plan %s: %s" % ( err_msg = ("Error retrieving environment for plan %s: %s" % (
self.container, err)) self.container, err))
LOG.exception(err_msg) LOG.exception(err_msg)
return mistral_workflow_utils.Result(error=err_msg) return actions.Result(error=err_msg)
selected_envs = [item['path'] for item in env['environments'] selected_envs = [item['path'] for item in env['environments']
if 'path' in item] if 'path' in item]
@ -172,7 +172,7 @@ class UpdateCapabilitiesAction(base.TripleOAction):
err_msg = ("Error retrieving environment for plan %s: %s" % ( err_msg = ("Error retrieving environment for plan %s: %s" % (
self.container, err)) self.container, err))
LOG.exception(err_msg) LOG.exception(err_msg)
return mistral_workflow_utils.Result(error=err_msg) return actions.Result(error=err_msg)
for k, v in self.environments.items(): for k, v in self.environments.items():
found = False found = False
@ -197,6 +197,6 @@ class UpdateCapabilitiesAction(base.TripleOAction):
except swiftexceptions.ClientException as err: except swiftexceptions.ClientException as err:
err_msg = "Error uploading to container: %s" % err err_msg = "Error uploading to container: %s" % err
LOG.exception(err_msg) LOG.exception(err_msg)
return mistral_workflow_utils.Result(error=err_msg) return actions.Result(error=err_msg)
return env return env

View File

@ -17,7 +17,7 @@ import time
from heatclient.common import template_utils from heatclient.common import template_utils
from heatclient import exc as heat_exc from heatclient import exc as heat_exc
from mistral.workflow import utils as mistral_workflow_utils from mistral_lib import actions
from swiftclient import exceptions as swiftexceptions from swiftclient import exceptions as swiftexceptions
from tripleo_common.actions import base from tripleo_common.actions import base
@ -57,7 +57,7 @@ class UpdateStackAction(templates.ProcessTemplatesAction):
except heat_exc.HTTPNotFound: except heat_exc.HTTPNotFound:
msg = "Error retrieving stack: %s" % self.container msg = "Error retrieving stack: %s" % self.container
LOG.exception(msg) LOG.exception(msg)
return mistral_workflow_utils.Result(error=msg) return actions.Result(error=msg)
parameters = dict() parameters = dict()
timestamp = int(time.time()) timestamp = int(time.time())
@ -73,7 +73,7 @@ class UpdateStackAction(templates.ProcessTemplatesAction):
err_msg = ("Error retrieving environment for plan %s: %s" % ( err_msg = ("Error retrieving environment for plan %s: %s" % (
self.container, err)) self.container, err))
LOG.exception(err_msg) LOG.exception(err_msg)
return mistral_workflow_utils.Result(error=err_msg) return actions.Result(error=err_msg)
try: try:
plan_utils.update_in_env(swift, env, 'parameter_defaults', plan_utils.update_in_env(swift, env, 'parameter_defaults',
@ -82,14 +82,14 @@ class UpdateStackAction(templates.ProcessTemplatesAction):
err_msg = ("Error updating environment for plan %s: %s" % ( err_msg = ("Error updating environment for plan %s: %s" % (
self.container, err)) self.container, err))
LOG.exception(err_msg) LOG.exception(err_msg)
return mistral_workflow_utils.Result(error=err_msg) return actions.Result(error=err_msg)
# process all plan files and create or update a stack # process all plan files and create or update a stack
processed_data = super(UpdateStackAction, self).run(context) processed_data = super(UpdateStackAction, self).run(context)
# If we receive a 'Result' instance it is because the parent action # If we receive a 'Result' instance it is because the parent action
# had an error. # had an error.
if isinstance(processed_data, mistral_workflow_utils.Result): if isinstance(processed_data, actions.Result):
return processed_data return processed_data
stack_args = processed_data.copy() stack_args = processed_data.copy()

View File

@ -30,7 +30,7 @@ import logging
import uuid import uuid
from heatclient import exc as heat_exc from heatclient import exc as heat_exc
from mistral.workflow import utils as mistral_workflow_utils from mistral_lib import actions
from swiftclient import exceptions as swiftexceptions from swiftclient import exceptions as swiftexceptions
from tripleo_common.actions import base from tripleo_common.actions import base
@ -61,7 +61,7 @@ class GetParametersAction(templates.ProcessTemplatesAction):
# If we receive a 'Result' instance it is because the parent action # If we receive a 'Result' instance it is because the parent action
# had an error. # had an error.
if isinstance(processed_data, mistral_workflow_utils.Result): if isinstance(processed_data, actions.Result):
return processed_data return processed_data
processed_data['show_nested'] = True processed_data['show_nested'] = True
@ -76,7 +76,7 @@ class GetParametersAction(templates.ProcessTemplatesAction):
err_msg = ("Error retrieving environment for plan %s: %s" % ( err_msg = ("Error retrieving environment for plan %s: %s" % (
self.container, err)) self.container, err))
LOG.exception(err_msg) LOG.exception(err_msg)
return mistral_workflow_utils.Result(error=err_msg) return actions.Result(error=err_msg)
params = env.get('parameter_defaults') params = env.get('parameter_defaults')
@ -114,7 +114,7 @@ class ResetParametersAction(base.TripleOAction):
err_msg = ("Error retrieving environment for plan %s: %s" % ( err_msg = ("Error retrieving environment for plan %s: %s" % (
self.container, err)) self.container, err))
LOG.exception(err_msg) LOG.exception(err_msg)
return mistral_workflow_utils.Result(error=err_msg) return actions.Result(error=err_msg)
try: try:
plan_utils.update_in_env(swift, env, 'parameter_defaults', plan_utils.update_in_env(swift, env, 'parameter_defaults',
@ -123,7 +123,7 @@ class ResetParametersAction(base.TripleOAction):
err_msg = ("Error updating environment for plan %s: %s" % ( err_msg = ("Error updating environment for plan %s: %s" % (
self.container, err)) self.container, err))
LOG.exception(err_msg) LOG.exception(err_msg)
return mistral_workflow_utils.Result(error=err_msg) return actions.Result(error=err_msg)
self.cache_delete(context, self.cache_delete(context,
self.container, self.container,
@ -149,7 +149,7 @@ class UpdateParametersAction(base.TripleOAction):
err_msg = ("Error retrieving environment for plan %s: %s" % ( err_msg = ("Error retrieving environment for plan %s: %s" % (
self.container, err)) self.container, err))
LOG.exception(err_msg) LOG.exception(err_msg)
return mistral_workflow_utils.Result(error=err_msg) return actions.Result(error=err_msg)
try: try:
plan_utils.update_in_env(swift, env, 'parameter_defaults', plan_utils.update_in_env(swift, env, 'parameter_defaults',
@ -158,7 +158,7 @@ class UpdateParametersAction(base.TripleOAction):
err_msg = ("Error updating environment for plan %s: %s" % ( err_msg = ("Error updating environment for plan %s: %s" % (
self.container, err)) self.container, err))
LOG.exception(err_msg) LOG.exception(err_msg)
return mistral_workflow_utils.Result(error=err_msg) return actions.Result(error=err_msg)
self.cache_delete(context, self.cache_delete(context,
self.container, self.container,
@ -205,7 +205,7 @@ class GeneratePasswordsAction(base.TripleOAction):
err_msg = ("Error retrieving environment for plan %s: %s" % ( err_msg = ("Error retrieving environment for plan %s: %s" % (
self.container, err)) self.container, err))
LOG.exception(err_msg) LOG.exception(err_msg)
return mistral_workflow_utils.Result(error=err_msg) return actions.Result(error=err_msg)
try: try:
stack_env = heat.stacks.environment( stack_env = heat.stacks.environment(
@ -230,7 +230,7 @@ class GeneratePasswordsAction(base.TripleOAction):
except swiftexceptions.ClientException as err: except swiftexceptions.ClientException as err:
err_msg = "Error uploading to container: %s" % err err_msg = "Error uploading to container: %s" % err
LOG.exception(err_msg) LOG.exception(err_msg)
return mistral_workflow_utils.Result(error=err_msg) return actions.Result(error=err_msg)
self.cache_delete(context, self.cache_delete(context,
self.container, self.container,
@ -259,7 +259,7 @@ class GetPasswordsAction(base.TripleOAction):
err_msg = ("Error retrieving environment for plan %s: %s" % ( err_msg = ("Error retrieving environment for plan %s: %s" % (
self.container, err)) self.container, err))
LOG.exception(err_msg) LOG.exception(err_msg)
return mistral_workflow_utils.Result(error=err_msg) return actions.Result(error=err_msg)
parameter_defaults = env.get('parameter_defaults', {}) parameter_defaults = env.get('parameter_defaults', {})
passwords = env.get('passwords', {}) passwords = env.get('passwords', {})
@ -423,7 +423,7 @@ class GetFlattenedParametersAction(GetParametersAction):
# If we receive a 'Result' instance it is because the parent action # If we receive a 'Result' instance it is because the parent action
# had an error. # had an error.
if isinstance(processed_data, mistral_workflow_utils.Result): if isinstance(processed_data, actions.Result):
return processed_data return processed_data
if processed_data['heat_resource_tree']: if processed_data['heat_resource_tree']:
@ -458,7 +458,7 @@ class GetProfileOfFlavorAction(base.TripleOAction):
compute_client) compute_client)
except exception.DeriveParamsError as err: except exception.DeriveParamsError as err:
LOG.error('Derive Params Error: %s', err) LOG.error('Derive Params Error: %s', err)
return mistral_workflow_utils.Result(error=str(err)) return actions.Result(error=str(err))
class RotateFernetKeysAction(GetPasswordsAction): class RotateFernetKeysAction(GetPasswordsAction):
@ -481,7 +481,7 @@ class RotateFernetKeysAction(GetPasswordsAction):
err_msg = ("Error retrieving environment for plan %s: %s" % ( err_msg = ("Error retrieving environment for plan %s: %s" % (
self.container, err)) self.container, err))
LOG.exception(err_msg) LOG.exception(err_msg)
return mistral_workflow_utils.Result(error=err_msg) return actions.Result(error=err_msg)
parameter_defaults = env.get('parameter_defaults', {}) parameter_defaults = env.get('parameter_defaults', {})
passwords = self._get_overriden_passwords(env.get('passwords', {}), passwords = self._get_overriden_passwords(env.get('passwords', {}),
@ -500,7 +500,7 @@ class RotateFernetKeysAction(GetPasswordsAction):
except swiftexceptions.ClientException as err: except swiftexceptions.ClientException as err:
err_msg = "Error uploading to container: %s" % err err_msg = "Error uploading to container: %s" % err
LOG.exception(err_msg) LOG.exception(err_msg)
return mistral_workflow_utils.Result(error=err_msg) return actions.Result(error=err_msg)
self.cache_delete(context, self.cache_delete(context,
self.container, self.container,

View File

@ -20,7 +20,7 @@ import yaml
from heatclient import exc as heatexceptions from heatclient import exc as heatexceptions
from keystoneauth1 import exceptions as keystoneauth_exc from keystoneauth1 import exceptions as keystoneauth_exc
from mistral.workflow import utils as mistral_workflow_utils from mistral_lib import actions
from mistralclient.api import base as mistralclient_base from mistralclient.api import base as mistralclient_base
from oslo_concurrency import processutils from oslo_concurrency import processutils
import six import six
@ -60,14 +60,14 @@ class CreateContainerAction(base.TripleOAction):
if not pattern_validator(constants.PLAN_NAME_PATTERN, self.container): if not pattern_validator(constants.PLAN_NAME_PATTERN, self.container):
message = ("Unable to create plan. The plan name must " message = ("Unable to create plan. The plan name must "
"only contain letters, numbers or dashes") "only contain letters, numbers or dashes")
return mistral_workflow_utils.Result(error=message) return actions.Result(error=message)
# checks to see if a container with that name exists # checks to see if a container with that name exists
if self.container in [container["name"] for container in if self.container in [container["name"] for container in
oc.get_account()[1]]: oc.get_account()[1]]:
result_string = ("A container with the name %s already" result_string = ("A container with the name %s already"
" exists.") % self.container " exists.") % self.container
return mistral_workflow_utils.Result(error=result_string) return actions.Result(error=result_string)
oc.put_container(self.container, headers=default_container_headers) oc.put_container(self.container, headers=default_container_headers)
@ -177,7 +177,7 @@ class DeletePlanAction(base.TripleOAction):
error_text = six.text_type(err) error_text = six.text_type(err)
if error_text: if error_text:
return mistral_workflow_utils.Result(error=error_text) return actions.Result(error=error_text)
class ListRolesAction(base.TripleOAction): class ListRolesAction(base.TripleOAction):
@ -202,7 +202,7 @@ class ListRolesAction(base.TripleOAction):
err_msg = ("Error retrieving roles data from deployment plan: %s" err_msg = ("Error retrieving roles data from deployment plan: %s"
% err) % err)
LOG.exception(err_msg) LOG.exception(err_msg)
return mistral_workflow_utils.Result(error=err_msg) return actions.Result(error=err_msg)
return [role['name'] for role in roles_data] return [role['name'] for role in roles_data]
@ -263,15 +263,15 @@ class ExportPlanAction(base.TripleOAction):
self._create_and_upload_tarball(swift, tmp_dir) self._create_and_upload_tarball(swift, tmp_dir)
except swiftexceptions.ClientException as err: except swiftexceptions.ClientException as err:
msg = "Error attempting an operation on container: %s" % err msg = "Error attempting an operation on container: %s" % err
return mistral_workflow_utils.Result(error=msg) return actions.Result(error=msg)
except (OSError, IOError) as err: except (OSError, IOError) as err:
msg = "Error while writing file: %s" % err msg = "Error while writing file: %s" % err
return mistral_workflow_utils.Result(error=msg) return actions.Result(error=msg)
except processutils.ProcessExecutionError as err: except processutils.ProcessExecutionError as err:
msg = "Error while creating a tarball: %s" % err msg = "Error while creating a tarball: %s" % err
return mistral_workflow_utils.Result(error=msg) return actions.Result(error=msg)
except Exception as err: except Exception as err:
msg = "Error exporting plan: %s" % err msg = "Error exporting plan: %s" % err
return mistral_workflow_utils.Result(error=msg) return actions.Result(error=msg)
finally: finally:
shutil.rmtree(tmp_dir) shutil.rmtree(tmp_dir)

View File

@ -15,8 +15,7 @@
import collections import collections
import logging import logging
from mistral.workflow import utils as mistral_workflow_utils from mistral_lib import actions
from tripleo_common.actions import parameters as parameters_actions from tripleo_common.actions import parameters as parameters_actions
from tripleo_common.actions import templates from tripleo_common.actions import templates
@ -72,11 +71,11 @@ class ScaleDownAction(templates.ProcessTemplatesAction):
update_params_action = parameters_actions.UpdateParametersAction( update_params_action = parameters_actions.UpdateParametersAction(
parameters, self.container) parameters, self.container)
updated_plan = update_params_action.run(context) updated_plan = update_params_action.run(context)
if isinstance(updated_plan, mistral_workflow_utils.Result): if isinstance(updated_plan, actions.Result):
return updated_plan return updated_plan
processed_data = super(ScaleDownAction, self).run(context) processed_data = super(ScaleDownAction, self).run(context)
if isinstance(processed_data, mistral_workflow_utils.Result): if isinstance(processed_data, actions.Result):
return processed_data return processed_data
update.add_breakpoints_cleanup_into_env(processed_data['environment']) update.add_breakpoints_cleanup_into_env(processed_data['environment'])

View File

@ -15,7 +15,7 @@
import uuid import uuid
from mistral.workflow import utils as mistral_workflow_utils from mistral_lib import actions
from six.moves import urllib from six.moves import urllib
from swiftclient import exceptions as swiftexceptions from swiftclient import exceptions as swiftexceptions
from swiftclient.utils import generate_temp_url from swiftclient.utils import generate_temp_url
@ -44,7 +44,7 @@ class SwiftInformationAction(base.TripleOAction):
except Exception as err: except Exception as err:
error = str(err) error = str(err)
return mistral_workflow_utils.Result(data=data, error=error) return actions.Result(data=data, error=error)
class SwiftTempUrlAction(base.TripleOAction): class SwiftTempUrlAction(base.TripleOAction):

View File

@ -22,7 +22,7 @@ import tempfile as tf
import yaml import yaml
from heatclient.common import template_utils from heatclient.common import template_utils
from mistral.workflow import utils as mistral_workflow_utils from mistral_lib import actions
from swiftclient import exceptions as swiftexceptions from swiftclient import exceptions as swiftexceptions
from tripleo_common.actions import base from tripleo_common.actions import base
@ -259,7 +259,7 @@ class ProcessTemplatesAction(base.TripleOAction):
err_msg = ("Error retrieving environment for plan %s: %s" % ( err_msg = ("Error retrieving environment for plan %s: %s" % (
self.container, err)) self.container, err))
LOG.exception(err_msg) LOG.exception(err_msg)
return mistral_workflow_utils.Result(error=err_msg) return actions.Result(error=error_text)
try: try:
# if the jinja overcloud template exists, process it and write it # if the jinja overcloud template exists, process it and write it
@ -271,7 +271,7 @@ class ProcessTemplatesAction(base.TripleOAction):
self._process_custom_roles(context) self._process_custom_roles(context)
except Exception as err: except Exception as err:
LOG.exception("Error occurred while processing custom roles.") LOG.exception("Error occurred while processing custom roles.")
return mistral_workflow_utils.Result(error=six.text_type(err)) return actions.Result(error=six.text_type(err))
template_name = plan_env.get('template') template_name = plan_env.get('template')
environments = plan_env.get('environments') environments = plan_env.get('environments')
@ -337,7 +337,7 @@ class ProcessTemplatesAction(base.TripleOAction):
os.remove(f) os.remove(f)
if error_text: if error_text:
return mistral_workflow_utils.Result(error=error_text) return actions.Result(error=error_text)
files = dict(list(template_files.items()) + list(env_files.items())) files = dict(list(template_files.items()) + list(env_files.items()))

View File

@ -12,7 +12,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from mistral.workflow import utils as mistral_workflow_utils from mistral_lib import actions
from mistralclient.api import base as mistralclient_api from mistralclient.api import base as mistralclient_api
from oslo_concurrency.processutils import ProcessExecutionError from oslo_concurrency.processutils import ProcessExecutionError
@ -78,7 +78,7 @@ class Enabled(base.TripleOAction):
else: else:
return_value['stdout'] = 'Validations are disabled' return_value['stdout'] = 'Validations are disabled'
mistral_result = {"error": return_value} mistral_result = {"error": return_value}
return mistral_workflow_utils.Result(**mistral_result) return actions.Result(**mistral_result)
class ListValidationsAction(base.TripleOAction): class ListValidationsAction(base.TripleOAction):
@ -133,7 +133,7 @@ class RunValidationAction(base.TripleOAction):
finally: finally:
if identity_file: if identity_file:
utils.cleanup_identity_file(identity_file) utils.cleanup_identity_file(identity_file)
return mistral_workflow_utils.Result(**mistral_result) return actions.Result(**mistral_result)
class CheckBootImagesAction(base.TripleOAction): class CheckBootImagesAction(base.TripleOAction):
@ -162,9 +162,9 @@ class CheckBootImagesAction(base.TripleOAction):
} }
if messages: if messages:
mistral_result = mistral_workflow_utils.Result(error=return_value) mistral_result = actions.Result(error=return_value)
else: else:
mistral_result = mistral_workflow_utils.Result(data=return_value) mistral_result = actions.Result(data=return_value)
return mistral_result return mistral_result
@ -257,7 +257,7 @@ class CheckFlavorsAction(base.TripleOAction):
else: else:
mistral_result = {'data': return_value} mistral_result = {'data': return_value}
return mistral_workflow_utils.Result(**mistral_result) return actions.Result(**mistral_result)
class CheckNodeBootConfigurationAction(base.TripleOAction): class CheckNodeBootConfigurationAction(base.TripleOAction):
@ -311,7 +311,7 @@ class CheckNodeBootConfigurationAction(base.TripleOAction):
else: else:
mistral_result = {'data': return_value} mistral_result = {'data': return_value}
return mistral_workflow_utils.Result(**mistral_result) return actions.Result(**mistral_result)
class VerifyProfilesAction(base.TripleOAction): class VerifyProfilesAction(base.TripleOAction):
@ -398,7 +398,7 @@ class VerifyProfilesAction(base.TripleOAction):
else: else:
mistral_result = {'data': return_value} mistral_result = {'data': return_value}
return mistral_workflow_utils.Result(**mistral_result) return actions.Result(**mistral_result)
def _node_get_capabilities(self, node): def _node_get_capabilities(self, node):
"""Get node capabilities.""" """Get node capabilities."""
@ -476,4 +476,4 @@ class CheckNodesCountAction(base.TripleOAction):
else: else:
mistral_result = {'data': return_value} mistral_result = {'data': return_value}
return mistral_workflow_utils.Result(**mistral_result) return actions.Result(**mistral_result)

View File

@ -20,7 +20,6 @@ import tempfile
from git import Repo from git import Repo
import six import six
from mistral.workflow import utils as mistral_workflow_utils
from mistral_lib import actions from mistral_lib import actions
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -54,7 +53,7 @@ class GitCloneAction(actions.Action):
except Exception: except Exception:
err_msg = ("Error cloning remote repository: %s " % url_bits[0]) err_msg = ("Error cloning remote repository: %s " % url_bits[0])
LOG.exception(err_msg) LOG.exception(err_msg)
return mistral_workflow_utils.Result(error=err_msg) return actions.Result(error=err_msg)
# if a tag value was given, checkout that tag # if a tag value was given, checkout that tag
if len(url_bits) > 1: if len(url_bits) > 1:
@ -70,7 +69,7 @@ class GitCloneAction(actions.Action):
LOG.exception(err_msg) LOG.exception(err_msg)
if err_msg: if err_msg:
return mistral_workflow_utils.Result(error=err_msg) return actions.Result(error=err_msg)
return local_dir_path return local_dir_path
@ -93,7 +92,7 @@ class GitCleanupAction(actions.Action):
shutil.rmtree(path) shutil.rmtree(path)
except IndexError as idx_err: except IndexError as idx_err:
LOG.exception("Directory not found: %s" % target_path) LOG.exception("Directory not found: %s" % target_path)
return mistral_workflow_utils.Result(error=six.text_type(idx_err)) return actions.Result(error=six.text_type(idx_err))
except OSError as os_err: except OSError as os_err:
LOG.exception("Error removing directory: %s" % target_path) LOG.exception("Error removing directory: %s" % target_path)
return mistral_workflow_utils.Result(error=six.text_type(os_err)) return actions.Result(error=six.text_type(os_err))

View File

@ -16,7 +16,7 @@ import mock
import yaml import yaml
from heatclient import exc as heat_exc from heatclient import exc as heat_exc
from mistral.workflow import utils as mistral_workflow_utils from mistral_lib import actions
from swiftclient import exceptions as swiftexceptions from swiftclient import exceptions as swiftexceptions
from tripleo_common.actions import deployment from tripleo_common.actions import deployment
@ -117,7 +117,7 @@ class OrchestrationDeployActionTest(base.TestCase):
action = deployment.OrchestrationDeployAction(self.server_id, action = deployment.OrchestrationDeployAction(self.server_id,
self.config, self.name) self.config, self.name)
expected = mistral_workflow_utils.Result( expected = actions.Result(
data={"deploy_status_code": 0}, data={"deploy_status_code": 0},
error=None) error=None)
self.assertEqual(expected, action.run(context=mock_ctx)) self.assertEqual(expected, action.run(context=mock_ctx))
@ -156,7 +156,7 @@ class OrchestrationDeployActionTest(base.TestCase):
action = deployment.OrchestrationDeployAction(self.server_id, action = deployment.OrchestrationDeployAction(self.server_id,
self.config, self.name) self.config, self.name)
expected = mistral_workflow_utils.Result( expected = actions.Result(
data={}, data={},
error="Timeout for heat deployment 'name'") error="Timeout for heat deployment 'name'")
self.assertEqual(expected, action.run(mock_ctx)) self.assertEqual(expected, action.run(mock_ctx))
@ -190,7 +190,7 @@ class OrchestrationDeployActionTest(base.TestCase):
action = deployment.OrchestrationDeployAction(self.server_id, action = deployment.OrchestrationDeployAction(self.server_id,
self.config, self.name) self.config, self.name)
expected = mistral_workflow_utils.Result( expected = actions.Result(
data={"deploy_status_code": 1}, data={"deploy_status_code": 1},
error="Heat deployment failed for 'name'") error="Heat deployment failed for 'name'")
self.assertEqual(expected, action.run(mock_ctx)) self.assertEqual(expected, action.run(mock_ctx))

View File

@ -15,7 +15,7 @@
import mock import mock
import yaml import yaml
from mistral.workflow import utils as mistral_workflow_utils from mistral_lib import actions
from swiftclient import exceptions as swiftexceptions from swiftclient import exceptions as swiftexceptions
from tripleo_common.actions import heat_capabilities from tripleo_common.actions import heat_capabilities
@ -150,7 +150,7 @@ class GetCapabilitiesActionTest(base.TestCase):
get_obj_client_mock.return_value = swift get_obj_client_mock.return_value = swift
action = heat_capabilities.GetCapabilitiesAction(self.container_name) action = heat_capabilities.GetCapabilitiesAction(self.container_name)
expected = mistral_workflow_utils.Result( expected = actions.Result(
data=None, data=None,
error="Error parsing capabilities-map.yaml.") error="Error parsing capabilities-map.yaml.")
self.assertEqual(expected, action.run(mock_ctx)) self.assertEqual(expected, action.run(mock_ctx))
@ -168,7 +168,7 @@ class GetCapabilitiesActionTest(base.TestCase):
get_obj_client_mock.return_value = swift get_obj_client_mock.return_value = swift
action = heat_capabilities.GetCapabilitiesAction(self.container_name) action = heat_capabilities.GetCapabilitiesAction(self.container_name)
expected = mistral_workflow_utils.Result( expected = actions.Result(
data=None, data=None,
error="Error retrieving environment for plan test-container: " error="Error retrieving environment for plan test-container: "
"test-container") "test-container")
@ -323,7 +323,7 @@ class UpdateCapabilitiesActionTest(base.TestCase):
action = heat_capabilities.UpdateCapabilitiesAction( action = heat_capabilities.UpdateCapabilitiesAction(
{}, self.container_name) {}, self.container_name)
expected = mistral_workflow_utils.Result( expected = actions.Result(
data=None, data=None,
error="Error retrieving environment for plan test-container: " error="Error retrieving environment for plan test-container: "
"test-container" "test-container"

View File

@ -15,7 +15,7 @@
import mock import mock
from heatclient import exc as heatexceptions from heatclient import exc as heatexceptions
from mistral.workflow import utils as mistral_workflow_utils from mistral_lib import actions
from oslo_concurrency import processutils from oslo_concurrency import processutils
from swiftclient import exceptions as swiftexceptions from swiftclient import exceptions as swiftexceptions
@ -113,7 +113,7 @@ class CreateContainerActionTest(base.TestCase):
error_str = ('A container with the name %s already' error_str = ('A container with the name %s already'
' exists.') % self.container_name ' exists.') % self.container_name
self.assertEqual(result, mistral_workflow_utils.Result( self.assertEqual(result, actions.Result(
None, error_str)) None, error_str))
@mock.patch('tripleo_common.actions.base.TripleOAction.get_object_client') @mock.patch('tripleo_common.actions.base.TripleOAction.get_object_client')
@ -128,7 +128,7 @@ class CreateContainerActionTest(base.TestCase):
error_str = ("Unable to create plan. The plan name must only contain " error_str = ("Unable to create plan. The plan name must only contain "
"letters, numbers or dashes") "letters, numbers or dashes")
self.assertEqual(result, mistral_workflow_utils.Result( self.assertEqual(result, actions.Result(
None, error_str)) None, error_str))

View File

@ -14,7 +14,7 @@
# under the License. # under the License.
import mock import mock
from mistral.workflow import utils as mistral_workflow_utils from mistral_lib import actions
from tripleo_common.actions import swifthelper from tripleo_common.actions import swifthelper
from tripleo_common.tests import base from tripleo_common.tests import base
@ -39,8 +39,7 @@ class SwiftInformationActionTest(base.TestCase):
'container_url': 'test_uri/{}'.format(self.container_name), 'container_url': 'test_uri/{}'.format(self.container_name),
'auth_key': 'test_token' 'auth_key': 'test_token'
} }
return_obj = mistral_workflow_utils.Result(data=return_data, return_obj = actions.Result(data=return_data, error=None)
error=None)
self.assertEqual(return_obj, self.action.run(mock_ctx)) self.assertEqual(return_obj, self.action.run(mock_ctx))
oc_mock.head_container.assert_called_with(self.container_name) oc_mock.head_container.assert_called_with(self.container_name)
@ -53,7 +52,7 @@ class SwiftInformationActionTest(base.TestCase):
oc_mock.head_container.side_effect = fail oc_mock.head_container.side_effect = fail
self.action.get_object_client.return_value = oc_mock self.action.get_object_client.return_value = oc_mock
return_obj = mistral_workflow_utils.Result(data=None, error='failure') return_obj = actions.Result(data=None, error='failure')
self.assertEqual(return_obj, self.action.run(mock_ctx)) self.assertEqual(return_obj, self.action.run(mock_ctx))

View File

@ -16,7 +16,7 @@ import collections
import mock import mock
from uuid import uuid4 from uuid import uuid4
from mistral.workflow import utils as mistral_workflow_utils from mistral_lib import actions
from oslo_concurrency.processutils import ProcessExecutionError from oslo_concurrency.processutils import ProcessExecutionError
from tripleo_common.actions import validations from tripleo_common.actions import validations
@ -166,7 +166,7 @@ class RunValidationActionTest(base.TestCase):
mock_write_identity_file.return_value = 'identity_file_path' mock_write_identity_file.return_value = 'identity_file_path'
mock_run_validation.return_value = 'output', 'error' mock_run_validation.return_value = 'output', 'error'
action = validations.RunValidationAction('validation') action = validations.RunValidationAction('validation')
expected = mistral_workflow_utils.Result( expected = actions.Result(
data={ data={
'stdout': 'output', 'stdout': 'output',
'stderr': 'error' 'stderr': 'error'
@ -200,7 +200,7 @@ class RunValidationActionTest(base.TestCase):
mock_run_validation.side_effect = ProcessExecutionError( mock_run_validation.side_effect = ProcessExecutionError(
stdout='output', stderr='error') stdout='output', stderr='error')
action = validations.RunValidationAction('validation') action = validations.RunValidationAction('validation')
expected = mistral_workflow_utils.Result( expected = actions.Result(
data=None, data=None,
error={ error={
'stdout': 'output', 'stdout': 'output',
@ -231,7 +231,7 @@ class TestCheckBootImagesAction(base.TestCase):
'._check_for_image') '._check_for_image')
def test_run(self, mock_check_for_image): def test_run(self, mock_check_for_image):
mock_check_for_image.side_effect = ['12345', '67890'] mock_check_for_image.side_effect = ['12345', '67890']
expected = mistral_workflow_utils.Result( expected = actions.Result(
data={ data={
'kernel_id': '12345', 'kernel_id': '12345',
'ramdisk_id': '67890', 'ramdisk_id': '67890',
@ -341,7 +341,7 @@ class TestCheckFlavorsAction(base.TestCase):
'role1': ('flavor1', 1), 'role1': ('flavor1', 1),
} }
expected = mistral_workflow_utils.Result( expected = actions.Result(
data={ data={
'flavors': { 'flavors': {
'flavor1': ( 'flavor1': (
@ -367,7 +367,7 @@ class TestCheckFlavorsAction(base.TestCase):
'role3': ('flavor3', 1), 'role3': ('flavor3', 1),
} }
expected = mistral_workflow_utils.Result( expected = actions.Result(
data={ data={
'flavors': { 'flavors': {
'flavor2': ( 'flavor2': (
@ -404,7 +404,7 @@ class TestCheckFlavorsAction(base.TestCase):
'role4': ('does_not_exist', 1), 'role4': ('does_not_exist', 1),
} }
expected = mistral_workflow_utils.Result( expected = actions.Result(
error={ error={
'errors': [ 'errors': [
"Flavor '%s' provided for the role '%s', does not " "Flavor '%s' provided for the role '%s', does not "
@ -440,7 +440,7 @@ class TestCheckNodeBootConfigurationAction(base.TestCase):
self.ctx = mock.MagicMock() self.ctx = mock.MagicMock()
def test_run_success(self): def test_run_success(self):
expected = mistral_workflow_utils.Result( expected = actions.Result(
data={'errors': [], 'warnings': []} data={'errors': [], 'warnings': []}
) )
@ -453,7 +453,7 @@ class TestCheckNodeBootConfigurationAction(base.TestCase):
self.assertEqual(expected, action.run(self.ctx)) self.assertEqual(expected, action.run(self.ctx))
def test_run_invalid_ramdisk(self): def test_run_invalid_ramdisk(self):
expected = mistral_workflow_utils.Result( expected = actions.Result(
error={ error={
'errors': [ 'errors': [
'Node 100f2cf6-06de-480e-a73e-6fdf6c9962b7 has an ' 'Node 100f2cf6-06de-480e-a73e-6fdf6c9962b7 has an '
@ -473,7 +473,7 @@ class TestCheckNodeBootConfigurationAction(base.TestCase):
self.assertEqual(expected, action.run(self.ctx)) self.assertEqual(expected, action.run(self.ctx))
def test_no_boot_option_local(self): def test_no_boot_option_local(self):
expected = mistral_workflow_utils.Result( expected = actions.Result(
data={ data={
'errors': [], 'errors': [],
'warnings': [ 'warnings': [
@ -543,7 +543,7 @@ class TestVerifyProfilesAction(base.TestCase):
self.nodes[:] = [self._get_fake_node(profile='fake'), self.nodes[:] = [self._get_fake_node(profile='fake'),
self._get_fake_node(profile='fake')] self._get_fake_node(profile='fake')]
expected = mistral_workflow_utils.Result( expected = actions.Result(
data={ data={
'errors': [], 'errors': [],
'warnings': [], 'warnings': [],
@ -554,7 +554,7 @@ class TestVerifyProfilesAction(base.TestCase):
self.nodes[:] = [self._get_fake_node(profile='compute'), self.nodes[:] = [self._get_fake_node(profile='compute'),
self._get_fake_node(profile='control')] self._get_fake_node(profile='control')]
expected = mistral_workflow_utils.Result( expected = actions.Result(
data={ data={
'errors': [], 'errors': [],
'warnings': [], 'warnings': [],
@ -567,7 +567,7 @@ class TestVerifyProfilesAction(base.TestCase):
self._get_fake_node(profile='foobar'), self._get_fake_node(profile='foobar'),
self._get_fake_node(profile='control')] self._get_fake_node(profile='control')]
expected = mistral_workflow_utils.Result( expected = actions.Result(
data={ data={
'warnings': [ 'warnings': [
'There are 1 ironic nodes with no profile that will not ' 'There are 1 ironic nodes with no profile that will not '
@ -583,7 +583,7 @@ class TestVerifyProfilesAction(base.TestCase):
self._get_fake_node(profile='compute'), self._get_fake_node(profile='compute'),
self._get_fake_node(profile='control')] self._get_fake_node(profile='control')]
expected = mistral_workflow_utils.Result( expected = actions.Result(
data={ data={
'warnings': ["2 nodes with profile compute won't be used for " 'warnings': ["2 nodes with profile compute won't be used for "
"deployment now"], "deployment now"],
@ -593,7 +593,7 @@ class TestVerifyProfilesAction(base.TestCase):
def test_no_nodes(self): def test_no_nodes(self):
# One error per each flavor # One error per each flavor
expected = mistral_workflow_utils.Result( expected = actions.Result(
error={'errors': ['Error: only 0 of 1 requested ironic nodes are ' error={'errors': ['Error: only 0 of 1 requested ironic nodes are '
'tagged to profile compute (for flavor ' 'tagged to profile compute (for flavor '
'compute)\n' 'compute)\n'
@ -619,7 +619,7 @@ class TestVerifyProfilesAction(base.TestCase):
def test_not_enough_nodes(self): def test_not_enough_nodes(self):
self.nodes[:] = [self._get_fake_node(profile='compute')] self.nodes[:] = [self._get_fake_node(profile='compute')]
expected = mistral_workflow_utils.Result( expected = actions.Result(
error={'errors': ['Error: only 0 of 1 requested ironic nodes are ' error={'errors': ['Error: only 0 of 1 requested ironic nodes are '
'tagged to profile control (for flavor ' 'tagged to profile control (for flavor '
'control).\n' 'control).\n'
@ -636,7 +636,7 @@ class TestVerifyProfilesAction(base.TestCase):
provision_state='active'), provision_state='active'),
self._get_fake_node(profile='control')] self._get_fake_node(profile='control')]
expected = mistral_workflow_utils.Result( expected = actions.Result(
data={ data={
'errors': [], 'errors': [],
'warnings': [], 'warnings': [],
@ -652,7 +652,7 @@ class TestVerifyProfilesAction(base.TestCase):
provision_state='cleaning'), provision_state='cleaning'),
self._get_fake_node(profile='compute', self._get_fake_node(profile='compute',
provision_state='error')] provision_state='error')]
expected = mistral_workflow_utils.Result( expected = actions.Result(
error={ error={
'warnings': [ 'warnings': [
'There are 1 ironic nodes with no profile that will not ' 'There are 1 ironic nodes with no profile that will not '
@ -683,7 +683,7 @@ class TestVerifyProfilesAction(base.TestCase):
self.nodes[:] = [self._get_fake_node(profile=None)] self.nodes[:] = [self._get_fake_node(profile=None)]
self.flavors = {'baremetal': ( self.flavors = {'baremetal': (
self._get_fake_flavor('baremetal', None), 1)} self._get_fake_flavor('baremetal', None), 1)}
expected = mistral_workflow_utils.Result( expected = actions.Result(
error={ error={
'warnings': [ 'warnings': [
'There are 1 ironic nodes with no profile that will not ' 'There are 1 ironic nodes with no profile that will not '
@ -734,7 +734,7 @@ class TestCheckNodesCountAction(base.TestCase):
action = validations.CheckNodesCountAction(**action_args) action = validations.CheckNodesCountAction(**action_args)
result = action.run(self.ctx) result = action.run(self.ctx)
expected = mistral_workflow_utils.Result( expected = actions.Result(
data={ data={
'result': { 'result': {
'requested_count': 2, 'requested_count': 2,
@ -756,7 +756,7 @@ class TestCheckNodesCountAction(base.TestCase):
action = validations.CheckNodesCountAction(**action_args) action = validations.CheckNodesCountAction(**action_args)
result = action.run(self.ctx) result = action.run(self.ctx)
expected = mistral_workflow_utils.Result( expected = actions.Result(
error={ error={
'errors': [ 'errors': [
'Only 0 nodes are exposed to Nova of 3 requests. Check ' 'Only 0 nodes are exposed to Nova of 3 requests. Check '
@ -779,7 +779,7 @@ class TestCheckNodesCountAction(base.TestCase):
action = validations.CheckNodesCountAction(**action_args) action = validations.CheckNodesCountAction(**action_args)
result = action.run(self.ctx) result = action.run(self.ctx)
expected = mistral_workflow_utils.Result( expected = actions.Result(
data={ data={
'errors': [], 'errors': [],
'warnings': [], 'warnings': [],
@ -799,7 +799,7 @@ class TestCheckNodesCountAction(base.TestCase):
action = validations.CheckNodesCountAction(**action_args) action = validations.CheckNodesCountAction(**action_args)
result = action.run(self.ctx) result = action.run(self.ctx)
expected = mistral_workflow_utils.Result( expected = actions.Result(
error={ error={
'errors': [ 'errors': [
"Not enough baremetal nodes - available: 3, requested: 4"], "Not enough baremetal nodes - available: 3, requested: 4"],
@ -821,7 +821,7 @@ class TestCheckNodesCountAction(base.TestCase):
action = validations.CheckNodesCountAction(**action_args) action = validations.CheckNodesCountAction(**action_args)
result = action.run(self.ctx) result = action.run(self.ctx)
expected = mistral_workflow_utils.Result( expected = actions.Result(
data={ data={
'errors': [], 'errors': [],
'warnings': [], 'warnings': [],
@ -842,7 +842,7 @@ class TestCheckNodesCountAction(base.TestCase):
action = validations.CheckNodesCountAction(**action_args) action = validations.CheckNodesCountAction(**action_args)
result = action.run(self.ctx) result = action.run(self.ctx)
expected = mistral_workflow_utils.Result( expected = actions.Result(
error={ error={
'errors': [ 'errors': [
'Not enough baremetal nodes - available: 3, requested: 4'], 'Not enough baremetal nodes - available: 3, requested: 4'],
@ -866,7 +866,7 @@ class TestCheckNodesCountAction(base.TestCase):
action = validations.CheckNodesCountAction(**action_args) action = validations.CheckNodesCountAction(**action_args)
result = action.run(self.ctx) result = action.run(self.ctx)
expected = mistral_workflow_utils.Result( expected = actions.Result(
error={ error={
'errors': [ 'errors': [
'Not enough baremetal nodes - available: 3, requested: 4'], 'Not enough baremetal nodes - available: 3, requested: 4'],

View File

@ -19,7 +19,7 @@ import tempfile
import uuid import uuid
import git import git
from mistral.workflow import utils as mistral_workflow_utils from mistral_lib import actions
from tripleo_common.actions import vcs from tripleo_common.actions import vcs
from tripleo_common.tests import base from tripleo_common.tests import base
@ -56,7 +56,7 @@ class GitCloneActionTest(base.TestCase):
action = vcs.GitCloneAction(self.container, self.git_url) action = vcs.GitCloneAction(self.container, self.git_url)
result = action.run(self.ctx) result = action.run(self.ctx)
expected = mistral_workflow_utils.Result( expected = actions.Result(
error="Error cloning remote repository: %s " % self.git_url error="Error cloning remote repository: %s " % self.git_url
) )
@ -82,7 +82,7 @@ class GitCloneActionTest(base.TestCase):
err_msg = ("Error finding %s reference from remote repository" % err_msg = ("Error finding %s reference from remote repository" %
self.tag_ref) self.tag_ref)
expected = mistral_workflow_utils.Result(error=err_msg) expected = actions.Result(error=err_msg)
self.assertEqual(result, expected, "Error messages don't match.") self.assertEqual(result, expected, "Error messages don't match.")
@ -107,7 +107,7 @@ class GitCloneActionTest(base.TestCase):
err_msg = ("Error checking out %s reference from remote " err_msg = ("Error checking out %s reference from remote "
"repository %s" % (self.tag_ref, self.git_url)) "repository %s" % (self.tag_ref, self.git_url))
expected = mistral_workflow_utils.Result(error=err_msg) expected = actions.Result(error=err_msg)
self.assertEqual(result, expected, "Error messages don't match.") self.assertEqual(result, expected, "Error messages don't match.")