Skip to content

Commit

Permalink
Do not create column if value is empty
Browse files Browse the repository at this point in the history
Cassandra/pycassa complains if we try to create a column with empty value. We
should create the column only if a valid value is to be written.

Change-Id: Id7810e698d09c98a6a816baf8bf882b6408dd71e
Partial-Bug: 1430089
  • Loading branch information
Sachin Bansal committed Oct 21, 2015
1 parent 6057324 commit 831cb87
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/config/schema-transformer/db.py
Expand Up @@ -12,6 +12,7 @@
from cfgm_common.zkclient import IndexAllocator
from cfgm_common.vnc_cassandra import VncCassandraClient
from sandesh_common.vns.constants import SCHEMA_KEYSPACE_NAME
import uuid

class SchemaTransformerDB(VncCassandraClient):

Expand Down Expand Up @@ -214,8 +215,12 @@ def get_service_chain_ip(self, sc_name):
return None, None

def add_service_chain_ip(self, sc_name, ip, ipv6):
self._sc_ip_cf.insert(sc_name, {'ip_address': ip,
'ipv6_address': ipv6})
val = {}
if ip:
val['ip_address'] = ip
if ipv6:
val['ipv6_address'] = ipv6
self._sc_ip_cf.insert(sc_name, val)

def remove_service_chain_ip(self, sc_name):
try:
Expand Down

0 comments on commit 831cb87

Please sign in to comment.