Skip to content

Commit b012af8

Browse files
author
Sahid Orentino Ferdjaoui
committed
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 <sferdjaoui@juniper.net> Change-Id: I6b145b1217658c964e994e16f64eb610cee8a624
1 parent 769b367 commit b012af8

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/config/common/cfgm_common/vnc_cassandra.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,21 @@ def _is_children(column_name):
6868

6969
def add(self, cf_name, key, value):
7070
try:
71-
self._cassandra_driver.get_cf(cf_name).insert(key, value)
71+
self._cassandra_driver.insert(key, value, cf_name=cf_name)
7272
return True
73-
except:
73+
except Exception as e:
74+
self._logger("VNCCassandra, unable to add {}={}, error: {}".format(
75+
key, value, e), level=SandeshLevel.SYS_WARN)
7476
return False
7577

7678
def delete(self, cf_name, key, columns=None):
7779
try:
78-
self._cassandra_driver.get_cf(cf_name).remove(key, columns=columns)
80+
self._cassandra_driver.remove(
81+
key, columns, cf_name=cf_name)
7982
return True
80-
except:
83+
except Exception as e:
84+
self._logger("VNCCassandra, unable to del {}={}, error: {}".format(
85+
key, columns, e), level=SandeshLevel.SYS_WARN)
8186
return False
8287

8388
def _get_resource_class(self, obj_type):

0 commit comments

Comments
 (0)