From f0ea11a68f43efec496cb3d1eb839ecbf3cdfbfd Mon Sep 17 00:00:00 2001 From: Kanagaraj Manickam Date: Wed, 29 Apr 2015 17:37:23 +0530 Subject: [PATCH] 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 --- heat/engine/service.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/heat/engine/service.py b/heat/engine/service.py index 73ee23452..367b3f4bb 100644 --- a/heat/engine/service.py +++ b/heat/engine/service.py @@ -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): - raise exception.NotSupported(feature='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') + # 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()