summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2014-09-30 23:32:41 +0000
committerGerrit Code Review <review@openstack.org>2014-09-30 23:32:41 +0000
commitff1f85c6099dfd285459f7c209f60ff840af2b4a (patch)
tree60f89ab13e099ef6b318cd45ab3b7c14cd8670bd
parente55162378dd15cee2e0b2503a0195120b78f8377 (diff)
parent8203b60aeb6f3f4abb45d1fdd9128a934a91aa10 (diff)
downloadheat-ff1f85c6099dfd285459f7c209f60ff840af2b4a.tar.gz
Merge "Disable Abandon & Adopt features by default"
-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)