Disable Abandon & Adopt features by default

Change-Id: I0c1e25650a3a6cab0211fb41eb2f6a02ef7dcc9f
Closes-Bug: #1375879
This commit is contained in:
Zane Bitter 2014-09-30 15:23:09 -04:00
parent 034e17151f
commit 8203b60aeb
4 changed files with 22 additions and 0 deletions

View File

@ -74,6 +74,12 @@
# value)
#enable_cloud_watch_lite=true
# Enable the preview Stack Abandon feature. (boolean value)
#enable_stack_abandon=false
# Enable the preview Stack Adopt feature. (boolean value)
#enable_stack_adopt=false
# Deprecated. (string value)
#onready=<None>

View File

@ -140,6 +140,12 @@ engine_opts = [
cfg.BoolOpt('enable_cloud_watch_lite',
default=True,
help=_('Enable the legacy OS::Heat::CWLiteAlarm resource.')),
cfg.BoolOpt('enable_stack_abandon',
default=False,
help=_('Enable the preview Stack Abandon feature.')),
cfg.BoolOpt('enable_stack_adopt',
default=False,
help=_('Enable the preview Stack Adopt feature.')),
cfg.StrOpt('onready',
help=_('Deprecated.'))]

View File

@ -54,6 +54,8 @@ from heat.rpc import api as rpc_api
cfg.CONF.import_opt('engine_life_check_timeout', 'heat.common.config')
cfg.CONF.import_opt('max_resources_per_stack', 'heat.common.config')
cfg.CONF.import_opt('max_stacks_per_tenant', 'heat.common.config')
cfg.CONF.import_opt('enable_stack_abandon', 'heat.common.config')
cfg.CONF.import_opt('enable_stack_adopt', 'heat.common.config')
LOG = logging.getLogger(__name__)
@ -596,6 +598,9 @@ class EngineService(service.Service):
# Create/Adopt a stack, and create the periodic task if successful
if stack.adopt_stack_data:
if not cfg.CONF.enable_stack_adopt:
raise exception.NotSupported(feature='Stack Adopt')
stack.adopt()
else:
stack.create()
@ -876,6 +881,9 @@ class EngineService(service.Service):
:param cnxt: RPC context.
:param stack_identity: Name of the stack you want to abandon.
"""
if not cfg.CONF.enable_stack_abandon:
raise exception.NotSupported(feature='Stack Abandon')
st = self._get_stack(cnxt, stack_identity)
LOG.info(_('abandoning stack %s') % st.name)
stack = parser.Stack.load(cnxt, stack=st)

View File

@ -55,6 +55,7 @@ from heat.tests import utils
from heat.tests.v1_1 import fakes
cfg.CONF.import_opt('engine_life_check_timeout', 'heat.common.config')
cfg.CONF.import_opt('enable_stack_abandon', 'heat.common.config')
wp_template = '''
{
@ -2023,6 +2024,7 @@ class StackServiceTest(HeatTestCase):
@stack_context('service_abandon_stack')
def test_abandon_stack(self):
cfg.CONF.set_override('enable_stack_abandon', True)
self.m.StubOutWithMock(parser.Stack, 'load')
parser.Stack.load(self.ctx,
stack=mox.IgnoreArg()).AndReturn(self.stack)