summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZane Bitter <zbitter@redhat.com>2014-09-30 15:23:09 -0400
committerZane Bitter <zbitter@redhat.com>2014-09-30 15:40:14 -0400
commit8203b60aeb6f3f4abb45d1fdd9128a934a91aa10 (patch)
treeb356fda5f69180f11fb623a63dd7eb3caddbe02c
parent034e17151fed13a2f5c606f947a2f2fbd350b083 (diff)
downloadheat-8203b60aeb6f3f4abb45d1fdd9128a934a91aa10.tar.gz
Disable Abandon & Adopt features by default
Change-Id: I0c1e25650a3a6cab0211fb41eb2f6a02ef7dcc9f Closes-Bug: #1375879
-rw-r--r--etc/heat/heat.conf.sample6
-rw-r--r--heat/common/config.py6
-rw-r--r--heat/engine/service.py8
-rw-r--r--heat/tests/test_engine_service.py2
4 files changed, 22 insertions, 0 deletions
diff --git a/etc/heat/heat.conf.sample b/etc/heat/heat.conf.sample
index 5443645c3..cce268340 100644
--- a/etc/heat/heat.conf.sample
+++ b/etc/heat/heat.conf.sample
@@ -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>
diff --git a/heat/common/config.py b/heat/common/config.py
index 1274faa0c..dfc96960d 100644
--- a/heat/common/config.py
+++ b/heat/common/config.py
@@ -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.'))]
diff --git a/heat/engine/service.py b/heat/engine/service.py
index b2909c852..b2f329db0 100644
--- a/heat/engine/service.py
+++ b/heat/engine/service.py
@@ -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)
diff --git a/heat/tests/test_engine_service.py b/heat/tests/test_engine_service.py
index 195426913..1d0157303 100644
--- a/heat/tests/test_engine_service.py
+++ b/heat/tests/test_engine_service.py
@@ -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)