Merge "Collect constants in one file"

This commit is contained in:
Jenkins
2016-03-17 14:27:19 +00:00
committed by Gerrit Code Review
3 changed files with 36 additions and 10 deletions

View File

@@ -0,0 +1,24 @@
# Copyright 2015 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#: The name of the root template in a standard tripleo-heat-template layout.
TEMPLATE_NAME = 'overcloud-without-mergepy.yaml'
#: The name of the type for resource groups.
RESOURCE_GROUP_TYPE = 'OS::Heat::ResourceGroup'
#: The resource name used for package updates
UPDATE_RESOURCE_NAME = 'UpdateDeployment'

View File

@@ -18,17 +18,17 @@ import logging
import os
from heatclient.common import template_utils
from tripleo_common import constants
from tripleo_common import update
LOG = logging.getLogger(__name__)
TEMPLATE_NAME = 'overcloud-without-mergepy.yaml'
RESOURCE_GROUP_TYPE = 'OS::Heat::ResourceGroup'
def get_group_resources_after_delete(groupname, res_to_delete, resources):
group = next(res for res in resources if
res.resource_name == groupname and
res.resource_type == RESOURCE_GROUP_TYPE)
res.resource_type == constants.RESOURCE_GROUP_TYPE)
members = []
for res in resources:
stack_name, stack_id = next(
@@ -95,7 +95,7 @@ class ScaleManager(object):
def _update_stack(self, parameters={}, timeout_mins=240):
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:

View File

@@ -18,17 +18,18 @@ import os
import time
from heatclient.common import template_utils
from tripleo_common import _stack_update
from tripleo_common import constants
LOG = logging.getLogger(__name__)
TEMPLATE_NAME = 'overcloud-without-mergepy.yaml'
UPDATE_RESOURCE_NAME = 'UpdateDeployment'
def add_breakpoints_cleanup_into_env(env):
template_utils.deep_update(env, {
'resource_registry': {
'resources': {'*': {'*': {UPDATE_RESOURCE_NAME: {'hooks': []}}}}
'resources': {'*': {'*': {
constants.UPDATE_RESOURCE_NAME: {'hooks': []}}}}
}
})
@@ -42,7 +43,7 @@ class PackageUpdateManager(_stack_update.StackUpdateManager):
super(PackageUpdateManager, self).__init__(
heatclient=heatclient, novaclient=novaclient, stack=stack,
hook_type='pre-update', nested_depth=5,
hook_resource=UPDATE_RESOURCE_NAME)
hook_resource=constants.UPDATE_RESOURCE_NAME)
def update(self, timeout_mins=240):
# time rounded to seconds
@@ -51,7 +52,7 @@ class PackageUpdateManager(_stack_update.StackUpdateManager):
stack_params = {'UpdateIdentifier': timestamp}
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)
@@ -63,7 +64,8 @@ class PackageUpdateManager(_stack_update.StackUpdateManager):
'resources': {
'*': {
'*': {
UPDATE_RESOURCE_NAME: {'hooks': 'pre-update'}
constants.UPDATE_RESOURCE_NAME: {
'hooks': 'pre-update'}
}
}
}