From 4f585a2e707840e9647f87c778bc7d9f212f3d93 Mon Sep 17 00:00:00 2001 From: Duc Truong Date: Mon, 30 Nov 2020 19:38:43 +0000 Subject: [PATCH] Check if config param exists before using it When using the cluster.stop_timeout_before_update config parameter, check if it exists before using it. That parameter is optional and should not error if it is not specified. Change-Id: Ic6b3172736f5cd348e391371f79defa1aeb790e6 --- senlin/engine/actions/cluster_action.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/senlin/engine/actions/cluster_action.py b/senlin/engine/actions/cluster_action.py index 2dbb05322..49a154b4a 100755 --- a/senlin/engine/actions/cluster_action.py +++ b/senlin/engine/actions/cluster_action.py @@ -302,9 +302,10 @@ class ClusterAction(base.Action): if config is not None: # make sure config values are valid try: - stop_timeout = config['cluster.stop_timeout_before_update'] - config['cluster.stop_timeout_before_update'] = int( - stop_timeout) + stop_timeout = config.get('cluster.stop_timeout_before_update') + if stop_timeout: + config['cluster.stop_timeout_before_update'] = int( + stop_timeout) except Exception as e: return self.RES_ERROR, str(e)