Remove ProcessTemplatesAction as base class
A number of actions still use ProcessTemplatesAction as a base class. This doesn't make sense in most cases. This is an attempt to decouple these classes. Change-Id: I93106288c3f085034efb79a89e01b705f70db6ee Co-Authored-By: Alex Schultz <aschultz@redhat.com>
This commit is contained in:
parent
de8d54bca5
commit
5a11fb16ad
@ -19,7 +19,7 @@ import tempfile
|
|||||||
|
|
||||||
from swiftclient import exceptions as swiftexceptions
|
from swiftclient import exceptions as swiftexceptions
|
||||||
|
|
||||||
from tripleo_common.actions import templates
|
from tripleo_common.actions import base
|
||||||
from tripleo_common import constants
|
from tripleo_common import constants
|
||||||
from tripleo_common.utils import config as ooo_config
|
from tripleo_common.utils import config as ooo_config
|
||||||
from tripleo_common.utils import swift as swiftutils
|
from tripleo_common.utils import swift as swiftutils
|
||||||
@ -28,7 +28,7 @@ from tripleo_common.utils import tarball
|
|||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class GetOvercloudConfig(templates.ProcessTemplatesAction):
|
class GetOvercloudConfig(base.TripleOAction):
|
||||||
"""Get the Overcloud Config from the Heat outputs
|
"""Get the Overcloud Config from the Heat outputs
|
||||||
|
|
||||||
This action gets the Overcloud config from the Heat outputs and
|
This action gets the Overcloud config from the Heat outputs and
|
||||||
@ -42,7 +42,7 @@ class GetOvercloudConfig(templates.ProcessTemplatesAction):
|
|||||||
config_dir=None,
|
config_dir=None,
|
||||||
container_config=constants.CONFIG_CONTAINER_NAME,
|
container_config=constants.CONFIG_CONTAINER_NAME,
|
||||||
config_type=None):
|
config_type=None):
|
||||||
super(GetOvercloudConfig, self).__init__(container)
|
super(GetOvercloudConfig, self).__init__()
|
||||||
self.container = container
|
self.container = container
|
||||||
self.config_dir = config_dir
|
self.config_dir = config_dir
|
||||||
self.config_type = config_type
|
self.config_type = config_type
|
||||||
@ -101,7 +101,7 @@ class GetOvercloudConfig(templates.ProcessTemplatesAction):
|
|||||||
shutil.rmtree(config_path)
|
shutil.rmtree(config_path)
|
||||||
|
|
||||||
|
|
||||||
class DownloadConfigAction(templates.ProcessTemplatesAction):
|
class DownloadConfigAction(base.TripleOAction):
|
||||||
"""Download the container config from swift
|
"""Download the container config from swift
|
||||||
|
|
||||||
This action downloads a container which contain the heat config output
|
This action downloads a container which contain the heat config output
|
||||||
@ -111,7 +111,7 @@ class DownloadConfigAction(templates.ProcessTemplatesAction):
|
|||||||
|
|
||||||
def __init__(self, container_config=constants.CONFIG_CONTAINER_NAME,
|
def __init__(self, container_config=constants.CONFIG_CONTAINER_NAME,
|
||||||
work_dir=None):
|
work_dir=None):
|
||||||
super(DownloadConfigAction, self).__init__(container_config)
|
super(DownloadConfigAction, self).__init__()
|
||||||
self.container_config = container_config
|
self.container_config = container_config
|
||||||
self.work_dir = work_dir
|
self.work_dir = work_dir
|
||||||
if not self.work_dir:
|
if not self.work_dir:
|
||||||
|
@ -130,12 +130,13 @@ class OrchestrationDeployAction(base.TripleOAction):
|
|||||||
return actions.Result(data=body_json, error=error)
|
return actions.Result(data=body_json, error=error)
|
||||||
|
|
||||||
|
|
||||||
class DeployStackAction(templates.ProcessTemplatesAction):
|
class DeployStackAction(base.TripleOAction):
|
||||||
"""Deploys a heat stack."""
|
"""Deploys a heat stack."""
|
||||||
|
|
||||||
def __init__(self, timeout, container=constants.DEFAULT_CONTAINER_NAME,
|
def __init__(self, timeout, container=constants.DEFAULT_CONTAINER_NAME,
|
||||||
skip_deploy_identifier=False):
|
skip_deploy_identifier=False):
|
||||||
super(DeployStackAction, self).__init__(container)
|
super(DeployStackAction, self).__init__()
|
||||||
|
self.container = container
|
||||||
self.timeout_mins = timeout
|
self.timeout_mins = timeout
|
||||||
self.skip_deploy_identifier = skip_deploy_identifier
|
self.skip_deploy_identifier = skip_deploy_identifier
|
||||||
|
|
||||||
@ -191,7 +192,10 @@ class DeployStackAction(templates.ProcessTemplatesAction):
|
|||||||
return actions.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)
|
process_templates_action = templates.ProcessTemplatesAction(
|
||||||
|
container=self.container
|
||||||
|
)
|
||||||
|
processed_data = process_templates_action.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.
|
||||||
|
@ -20,6 +20,7 @@ from heatclient import exc as heat_exc
|
|||||||
from mistral_lib import actions
|
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 templates
|
from tripleo_common.actions import templates
|
||||||
from tripleo_common import constants
|
from tripleo_common import constants
|
||||||
from tripleo_common.utils import plan as plan_utils
|
from tripleo_common.utils import plan as plan_utils
|
||||||
@ -27,10 +28,11 @@ from tripleo_common.utils import plan as plan_utils
|
|||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class UpdateStackAction(templates.ProcessTemplatesAction):
|
class UpdateStackAction(base.TripleOAction):
|
||||||
|
|
||||||
def __init__(self, timeout, container=constants.DEFAULT_CONTAINER_NAME):
|
def __init__(self, timeout, container=constants.DEFAULT_CONTAINER_NAME):
|
||||||
super(UpdateStackAction, self).__init__(container)
|
super(UpdateStackAction, self).__init__()
|
||||||
|
self.container = container
|
||||||
self.timeout_mins = timeout
|
self.timeout_mins = timeout
|
||||||
|
|
||||||
def run(self, context):
|
def run(self, context):
|
||||||
@ -86,7 +88,10 @@ class UpdateStackAction(templates.ProcessTemplatesAction):
|
|||||||
return actions.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)
|
process_templates_action = templates.ProcessTemplatesAction(
|
||||||
|
container=self.container
|
||||||
|
)
|
||||||
|
processed_data = process_templates_action.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.
|
||||||
|
@ -34,9 +34,13 @@ from tripleo_common.utils import plan as plan_utils
|
|||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class GetParametersAction(templates.ProcessTemplatesAction):
|
class GetParametersAction(base.TripleOAction):
|
||||||
"""Gets list of available heat parameters."""
|
"""Gets list of available heat parameters."""
|
||||||
|
|
||||||
|
def __init__(self, container=constants.DEFAULT_CONTAINER_NAME):
|
||||||
|
super(GetParametersAction, self).__init__()
|
||||||
|
self.container = container
|
||||||
|
|
||||||
def run(self, context):
|
def run(self, context):
|
||||||
|
|
||||||
cached = self.cache_get(context,
|
cached = self.cache_get(context,
|
||||||
@ -46,7 +50,10 @@ class GetParametersAction(templates.ProcessTemplatesAction):
|
|||||||
if cached is not None:
|
if cached is not None:
|
||||||
return cached
|
return cached
|
||||||
|
|
||||||
processed_data = super(GetParametersAction, self).run(context)
|
process_templates_action = templates.ProcessTemplatesAction(
|
||||||
|
container=self.container
|
||||||
|
)
|
||||||
|
processed_data = process_templates_action.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.
|
||||||
@ -122,7 +129,7 @@ class ResetParametersAction(base.TripleOAction):
|
|||||||
return env
|
return env
|
||||||
|
|
||||||
|
|
||||||
class UpdateParametersAction(templates.ProcessTemplatesAction):
|
class UpdateParametersAction(base.TripleOAction):
|
||||||
"""Updates plan environment with parameters."""
|
"""Updates plan environment with parameters."""
|
||||||
|
|
||||||
def __init__(self, parameters,
|
def __init__(self, parameters,
|
||||||
@ -159,7 +166,10 @@ class UpdateParametersAction(templates.ProcessTemplatesAction):
|
|||||||
LOG.exception(err_msg)
|
LOG.exception(err_msg)
|
||||||
return actions.Result(error=err_msg)
|
return actions.Result(error=err_msg)
|
||||||
|
|
||||||
processed_data = super(UpdateParametersAction, self).run(context)
|
process_templates_action = templates.ProcessTemplatesAction(
|
||||||
|
container=self.container
|
||||||
|
)
|
||||||
|
processed_data = process_templates_action.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.
|
||||||
@ -629,16 +639,19 @@ class RotateFernetKeysAction(GetPasswordsAction):
|
|||||||
return keys_map
|
return keys_map
|
||||||
|
|
||||||
|
|
||||||
class GetNetworkConfigAction(templates.ProcessTemplatesAction):
|
class GetNetworkConfigAction(base.TripleOAction):
|
||||||
"""Gets network configuration details from available heat parameters."""
|
"""Gets network configuration details from available heat parameters."""
|
||||||
|
|
||||||
def __init__(self, role_name, container=constants.DEFAULT_CONTAINER_NAME):
|
def __init__(self, role_name, container=constants.DEFAULT_CONTAINER_NAME):
|
||||||
super(GetNetworkConfigAction, self).__init__(container=container)
|
super(GetNetworkConfigAction, self).__init__()
|
||||||
|
self.container = container
|
||||||
self.role_name = role_name
|
self.role_name = role_name
|
||||||
|
|
||||||
def run(self, context):
|
def run(self, context):
|
||||||
|
process_templates_action = templates.ProcessTemplatesAction(
|
||||||
processed_data = super(GetNetworkConfigAction, self).run(context)
|
container=self.container
|
||||||
|
)
|
||||||
|
processed_data = process_templates_action.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.
|
||||||
|
@ -17,6 +17,7 @@ import logging
|
|||||||
|
|
||||||
from mistral_lib import actions
|
from mistral_lib import actions
|
||||||
|
|
||||||
|
from tripleo_common.actions import base
|
||||||
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
|
||||||
from tripleo_common import constants
|
from tripleo_common import constants
|
||||||
@ -48,7 +49,7 @@ def get_group_resources_after_delete(groupname, res_to_delete, resources):
|
|||||||
return members
|
return members
|
||||||
|
|
||||||
|
|
||||||
class ScaleDownAction(templates.ProcessTemplatesAction):
|
class ScaleDownAction(base.TripleOAction):
|
||||||
"""Deletes overcloud nodes
|
"""Deletes overcloud nodes
|
||||||
|
|
||||||
Before calling this method, ensure you have updated the plan
|
Before calling this method, ensure you have updated the plan
|
||||||
@ -57,9 +58,10 @@ class ScaleDownAction(templates.ProcessTemplatesAction):
|
|||||||
|
|
||||||
def __init__(self, timeout, nodes=[],
|
def __init__(self, timeout, nodes=[],
|
||||||
container=constants.DEFAULT_CONTAINER_NAME):
|
container=constants.DEFAULT_CONTAINER_NAME):
|
||||||
|
self.container = container
|
||||||
self.nodes = nodes
|
self.nodes = nodes
|
||||||
self.timeout_mins = timeout
|
self.timeout_mins = timeout
|
||||||
super(ScaleDownAction, self).__init__(container)
|
super(ScaleDownAction, self).__init__()
|
||||||
|
|
||||||
def _update_stack(self, parameters={},
|
def _update_stack(self, parameters={},
|
||||||
timeout_mins=constants.STACK_TIMEOUT_DEFAULT,
|
timeout_mins=constants.STACK_TIMEOUT_DEFAULT,
|
||||||
@ -74,7 +76,10 @@ class ScaleDownAction(templates.ProcessTemplatesAction):
|
|||||||
if isinstance(updated_plan, actions.Result):
|
if isinstance(updated_plan, actions.Result):
|
||||||
return updated_plan
|
return updated_plan
|
||||||
|
|
||||||
processed_data = super(ScaleDownAction, self).run(context)
|
process_templates_action = templates.ProcessTemplatesAction(
|
||||||
|
container=self.container
|
||||||
|
)
|
||||||
|
processed_data = process_templates_action.run(context)
|
||||||
if isinstance(processed_data, actions.Result):
|
if isinstance(processed_data, actions.Result):
|
||||||
return processed_data
|
return processed_data
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user