Merge "heat engine : Add support for disable_rollback to engine API"
This commit is contained in:
commit
ec325a6931
@ -35,6 +35,14 @@ def extract_args(params):
|
||||
else:
|
||||
if timeout_mins > 0:
|
||||
kwargs[PARAM_TIMEOUT] = timeout_mins
|
||||
|
||||
if PARAM_DISABLE_ROLLBACK in params:
|
||||
disable_rollback = params.get(PARAM_DISABLE_ROLLBACK)
|
||||
if disable_rollback in (True, False):
|
||||
kwargs[PARAM_DISABLE_ROLLBACK] = disable_rollback
|
||||
else:
|
||||
raise ValueError("Unexpected value for parameter %s : %s" %
|
||||
(PARAM_DISABLE_ROLLBACK, disable_rollback))
|
||||
return kwargs
|
||||
|
||||
|
||||
|
@ -12,7 +12,11 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
PARAM_KEYS = (PARAM_TIMEOUT, ) = ('timeout_mins', )
|
||||
PARAM_KEYS = (
|
||||
PARAM_TIMEOUT, PARAM_DISABLE_ROLLBACK
|
||||
) = (
|
||||
'timeout_mins', 'disable_rollback'
|
||||
)
|
||||
|
||||
STACK_KEYS = (
|
||||
STACK_NAME, STACK_ID,
|
||||
|
@ -45,3 +45,17 @@ class EngineApiTest(unittest.TestCase):
|
||||
def test_timeout_extract_not_present(self):
|
||||
args = api.extract_args({})
|
||||
self.assertTrue('timeout_mins' not in args)
|
||||
|
||||
def test_disable_rollback_extract_true(self):
|
||||
args = api.extract_args({'disable_rollback': True})
|
||||
self.assertTrue('disable_rollback' in args)
|
||||
self.assertTrue(args.get('disable_rollback'))
|
||||
|
||||
def test_disable_rollback_extract_false(self):
|
||||
args = api.extract_args({'disable_rollback': False})
|
||||
self.assertTrue('disable_rollback' in args)
|
||||
self.assertFalse(args.get('disable_rollback'))
|
||||
|
||||
def test_disable_rollback_extract_bad(self):
|
||||
self.assertRaises(ValueError, api.extract_args,
|
||||
{'disable_rollback': 'bad'})
|
||||
|
Loading…
Reference in New Issue
Block a user