Skip to content

Commit d4a9cda

Browse files
Add a new API connect_host to SonicV2Connector
1 parent 1109e49 commit d4a9cda

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/swsssdk/dbconnector.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,13 @@ def connect(self, db_name, retry_on=True):
267267
db_id = self.get_dbid(db_name)
268268
self.dbintf.connect(db_id, db_name, retry_on)
269269

270+
def connect_host(self, db_name, host, retry_on=True):
271+
self.dbintf.redis_kwargs["host"] = host
272+
self.dbintf.redis_kwargs["port"] = self.get_db_port(db_name)
273+
self.dbintf.redis_kwargs["unix_socket_path"] = None
274+
db_id = self.get_dbid(db_name)
275+
self.dbintf.connect(db_id, db_name, retry_on)
276+
270277
def close(self, db_name):
271278
self.dbintf.close(db_name)
272279

0 commit comments

Comments
 (0)