Code improvement: avoid reduntant if conditions

while adopting stack, the presence of adopt-data
is being checked twice, which can be done with
only once.

Change-Id: I90ef2df729879df50637ee5c1621f9756fed62fd
This commit is contained in:
Kanagaraj Manickam 2015-04-29 17:37:23 +05:30
parent d7cadf02c9
commit f0ea11a68f

View File

@ -578,13 +578,13 @@ class EngineService(service.Service):
stack_user_project_id=None,
convergence=False,
parent_resource_name=None):
# If it is stack-adopt, use parameters from adopt_stack_data
common_params = api.extract_args(args)
if (rpc_api.PARAM_ADOPT_STACK_DATA in common_params and
not cfg.CONF.enable_stack_adopt):
# If it is stack-adopt, use parameters from adopt_stack_data
if rpc_api.PARAM_ADOPT_STACK_DATA in common_params:
if not cfg.CONF.enable_stack_adopt:
raise exception.NotSupported(feature='Stack Adopt')
if rpc_api.PARAM_ADOPT_STACK_DATA in common_params:
# Override the params with values given with -P option
new_params = common_params[rpc_api.PARAM_ADOPT_STACK_DATA][
'environment'][rpc_api.STACK_PARAMETERS].copy()