From b012af8c59ba2225b0b1473d78976003da73d042 Mon Sep 17 00:00:00 2001 From: Sahid Orentino Ferdjaoui Date: Wed, 9 Sep 2020 10:38:23 +0200 Subject: [PATCH] config/common: fix functions that by-pass cassandra api Those two functions are by-passing the API by calling dirrectly internal objects. Related-Jira-Bug: CEM-10731 Signed-off-by: Sahid Orentino Ferdjaoui Change-Id: I6b145b1217658c964e994e16f64eb610cee8a624 --- src/config/common/cfgm_common/vnc_cassandra.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/config/common/cfgm_common/vnc_cassandra.py b/src/config/common/cfgm_common/vnc_cassandra.py index 949cce6fb0f..58bd97b4f82 100644 --- a/src/config/common/cfgm_common/vnc_cassandra.py +++ b/src/config/common/cfgm_common/vnc_cassandra.py @@ -68,16 +68,21 @@ def _is_children(column_name): def add(self, cf_name, key, value): try: - self._cassandra_driver.get_cf(cf_name).insert(key, value) + self._cassandra_driver.insert(key, value, cf_name=cf_name) return True - except: + except Exception as e: + self._logger("VNCCassandra, unable to add {}={}, error: {}".format( + key, value, e), level=SandeshLevel.SYS_WARN) return False def delete(self, cf_name, key, columns=None): try: - self._cassandra_driver.get_cf(cf_name).remove(key, columns=columns) + self._cassandra_driver.remove( + key, columns, cf_name=cf_name) return True - except: + except Exception as e: + self._logger("VNCCassandra, unable to del {}={}, error: {}".format( + key, columns, e), level=SandeshLevel.SYS_WARN) return False def _get_resource_class(self, obj_type):