Use a common constant for the Heat timeout value

Change-Id: Iab5a35b0d3ba3345133c5fe57a4bde631acbcd80
This commit is contained in:
Dougal Matthews 2016-03-17 16:40:16 +00:00
parent 6b15ba9ec1
commit e5fde39e2c
4 changed files with 13 additions and 8 deletions

View File

@ -22,3 +22,6 @@ RESOURCE_GROUP_TYPE = 'OS::Heat::ResourceGroup'
#: The resource name used for package updates
UPDATE_RESOURCE_NAME = 'UpdateDeployment'
#: The default timeout to pass to Heat stacks
STACK_TIMEOUT_DEFAULT = 240

View File

@ -92,7 +92,8 @@ class ScaleManager(object):
self._update_stack(parameters=stack_params)
def _update_stack(self, parameters={}, timeout_mins=240):
def _update_stack(self, parameters={},
timeout_mins=constants.STACK_TIMEOUT_DEFAULT):
tpl_files, template = template_utils.get_template_contents(
template_file=os.path.join(self.tht_dir, constants.TEMPLATE_NAME))

View File

@ -45,7 +45,7 @@ class PackageUpdateManager(_stack_update.StackUpdateManager):
hook_type='pre-update', nested_depth=5,
hook_resource=constants.UPDATE_RESOURCE_NAME)
def update(self, timeout_mins=240):
def update(self, timeout_mins=constants.STACK_TIMEOUT_DEFAULT):
# time rounded to seconds
timestamp = int(time.time())

View File

@ -18,12 +18,13 @@ import os
from heatclient.common import template_utils
from tripleo_common import constants
LOG = logging.getLogger(__name__)
TEMPLATE_NAME = 'overcloud-without-mergepy.yaml'
UPGRADE_PREPARE_ENVIRONMENT_NAME = 'major-upgrade-pacemaker-init.yaml'
UPGRADE_ENVIRONMENT_NAME = 'major-upgrade-pacemaker.yaml'
UPGRADE_CLEANUP_ENVIRONMENT_NAME = 'major-upgrade-pacemaker-converge.yaml'
STACK_TIMEOUT_DEFAULT = 240
class StackUpgradeManager(object):
@ -38,7 +39,7 @@ class StackUpgradeManager(object):
stack_params = {}
tpl_files, template = template_utils.get_template_contents(
template_file=os.path.join(self.tht_dir, TEMPLATE_NAME))
template_file=os.path.join(self.tht_dir, constants.TEMPLATE_NAME))
env_paths = []
if self.environment_files:
env_paths.extend(self.environment_files)
@ -62,15 +63,15 @@ class StackUpgradeManager(object):
self.heatclient.stacks.update(**fields)
def upgrade_pre(self, timeout_mins=STACK_TIMEOUT_DEFAULT):
def upgrade_pre(self, timeout_mins=constants.STACK_TIMEOUT_DEFAULT):
LOG.info('upgrading stack: %s', self.stack.stack_name)
self._update_stack(timeout_mins, UPGRADE_PREPARE_ENVIRONMENT_NAME)
def upgrade(self, timeout_mins=STACK_TIMEOUT_DEFAULT):
def upgrade(self, timeout_mins=constants.STACK_TIMEOUT_DEFAULT):
LOG.info('upgrading stack: %s', self.stack.stack_name)
self._update_stack(timeout_mins, UPGRADE_ENVIRONMENT_NAME)
def upgrade_post(self, timeout_mins=STACK_TIMEOUT_DEFAULT):
def upgrade_post(self, timeout_mins=constants.STACK_TIMEOUT_DEFAULT):
LOG.info('cleanup of stack upgrade for stack: %s',
self.stack.stack_name)
self._update_stack(timeout_mins, UPGRADE_CLEANUP_ENVIRONMENT_NAME)