-
Notifications
You must be signed in to change notification settings - Fork 336
Allow ssl connection to redis when use sentinel #953
Allow ssl connection to redis when use sentinel #953
Conversation
This diff allows to pass ssl=True inside **connection_kwargs for Sentinel class to enable ssl connection to redis Besides enabling functionality itself this change also makes experience with Sentinel() more consistent with Redis()
Codecov Report
@@ Coverage Diff @@
## master #953 +/- ##
=======================================
Coverage 91.85% 91.85%
=======================================
Files 17 17
Lines 5808 5808
Branches 489 489
=======================================
Hits 5335 5335
Misses 360 360
Partials 113 113
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
This pull request introduces 2 alerts when merging 431c960 into 260888e - view on LGTM.com new alerts:
|
This diff allows to pass ssl=True inside **connection_kwargs for Sentinel class to enable ssl connection to redis Besides enabling functionality itself this change also makes experience with Sentinel() more consistent with Redis()
…oredis-py into ssl_for_sentinel
This pull request introduces 2 alerts when merging a7c854c into 260888e - view on LGTM.com new alerts:
|
@Andrew-Chen-Wang any thoughts regarding this request? |
This pull request introduces 2 alerts when merging dd4f77a into 260888e - view on LGTM.com new alerts:
|
@stanislau-arkhipenka apologies for being super late. I'll look into this PR after finals, but take note of the PR in redis-py first: redis/redis-py#1306 I haven't take too much of a look through there, but it seems like they're doing some inheritance. Try and follow along and see if there are any diffs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stanislau-arkhipenka Do you mind replicating what's been done here instead of using an "ssl" option to be more close with redis-py implementation: redis/redis-py#1419
That PR's not been reviewed by @andymccurdy yet, but the implementation and comments made by him and others (and others' implementation like that at Celery) based on the original issue seems to be The Way: redis/redis-py#1306
Hey, actually originally i did pretty similar diff, but LGTM was not very happy because of diamand problem. MRO seems solves this problem, but it'll be definitely harder to read the code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR and fixing up the LGTM!
This diff allows to pass ssl=True inside **connection_kwargs for Sentinel class to enable ssl connection to redis
Besides enabling functionality itself this change also makes experience with Sentinel() more consistent with Redis()
Now SentinelManagedConnection enherits from SSLConnection, instead of Connection.
This allows to populate ssl related properties from SSLConnection class.
if ssl=True SentinelManagedConnection uses parents constructor (SSLConnection)
If ssl=False SentinelManagedConnection uses grandparents constructor (Connection class)
The only downside of this implementation, is in case ssl=False instance of SentinelManagedConnection has dangling ssl-cert related properties.This properties does not affect behavior in any considerable way.
Afaik there is no obvious way to overcome this issue.
Users now can pass SSL related attributes to **connection_kwargs in Sentinel class (or alternativelly to master_for or slave_for methods)